Chinaunix

标题: 如何利用脚本实现如下表空间和用户的自动创建? [打印本页]

作者: zhengyi158    时间: 2009-03-02 16:39
标题: 如何利用脚本实现如下表空间和用户的自动创建?
建立表空间
1.表空间名称为:test
2.临时表空间名称为:test_TMP

建立帐号
1.建立帐号:test3,密码:test3

帐号使用的表空间如下:
1.缺省表空间(Default tablespace): test
  2.临时表空间(Temporary tablespace): test_TMP

注意:需要给帐号设置test3足够的权限:CONNECT,RESOURCE,CREATE VIEW

[ 本帖最后由 zhengyi158 于 2009-3-3 09:37 编辑 ]
作者: welcome008    时间: 2009-03-02 16:39
原帖由 zhengyi158 于 2009-3-2 16:39 发表
建立表空间
1.表空间名称为:test
2.临时表空间名称为:test_TMP

建立帐号
1.建立帐号:test3,密码:test3

帐号使用的表空间如下:
1.缺省表空间(Default tablespace): test
  2.临时表空间(T ...



oracle9i下:

sqlplus system/system_pass@conn_str <<EOF

create tablespace test
    datafile '/oradata/test.dbf' size 30M reuse
        extent management local
        segment space management auto;
create temporary tablespace test_tmp
        TEMPFILE
                '/oradata/test_tmp.dbf' size 1020M reuse
                EXTENT MANAGEMENT LOCAL;

create user test3 identified by test3
default tablespace test
temporary tablespace test_tmp
quota unlimited on test
quota unlimited on test_tmp;

grant connect,resource to test3;
exit
EOF




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2