rem --创建回滚段
2024-07-21 02:38:16
供稿:网友
CREATE PUBLIC ROLLBACK SEGMENT RBS0 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS1 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS2 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS3 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS4 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS5 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS6 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS7 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS8 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS9 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS10 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS11 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS12 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS13 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS14 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS15 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS16 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS17 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS18 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS19 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS20 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS21 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS22 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS23 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
CREATE PUBLIC ROLLBACK SEGMENT RBS24 TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
rem --使回滚段在线
ALTER ROLLBACK SEGMENT "RBS0" ONLINE;
ALTER ROLLBACK SEGMENT "RBS1" ONLINE;
ALTER ROLLBACK SEGMENT "RBS2" ONLINE;
ALTER ROLLBACK SEGMENT "RBS3" ONLINE;
ALTER ROLLBACK SEGMENT "RBS4" ONLINE;
ALTER ROLLBACK SEGMENT "RBS5" ONLINE;
ALTER ROLLBACK SEGMENT "RBS6" ONLINE;
ALTER ROLLBACK SEGMENT "RBS7" ONLINE;
ALTER ROLLBACK SEGMENT "RBS8" ONLINE;
ALTER ROLLBACK SEGMENT "RBS9" ONLINE;
ALTER ROLLBACK SEGMENT "RBS10" ONLINE;
ALTER ROLLBACK SEGMENT "RBS11" ONLINE;
ALTER ROLLBACK SEGMENT "RBS12" ONLINE;
ALTER ROLLBACK SEGMENT "RBS13" ONLINE;
ALTER ROLLBACK SEGMENT "RBS14" ONLINE;
ALTER ROLLBACK SEGMENT "RBS15" ONLINE;
ALTER ROLLBACK SEGMENT "RBS16" ONLINE;
ALTER ROLLBACK SEGMENT "RBS17" ONLINE;
ALTER ROLLBACK SEGMENT "RBS18" ONLINE;
ALTER ROLLBACK SEGMENT "RBS19" ONLINE;
ALTER ROLLBACK SEGMENT "RBS20" ONLINE;
ALTER ROLLBACK SEGMENT "RBS21" ONLINE;
ALTER ROLLBACK SEGMENT "RBS22" ONLINE;
ALTER ROLLBACK SEGMENT "RBS23" ONLINE;
ALTER ROLLBACK SEGMENT "RBS24" ONLINE;
rem --修改sys用户的临时表空间为TEMP
alter user sys temporary tablespace TEMP;
rem --创建数据字典表
connect system/manager
@$Oracle_HOME/rdbms/admin/catdbsyn.sql
connect internal
@/data/ora816/rdbms/admin/catalog.sql;
@/data/ora816/rdbms/admin/cateXP7.sql
@/data/ora816/rdbms/admin/catPRoc.sql
@/data/ora816/rdbms/admin/caths.sql
connect system/manager
@/data/ora816/sqlplus/admin/pupbld.sql
connect internal/oracle
@/data/ora816/rdbms/admin/catrep.sql
rem --修改system用户默认表空间和临时表空间
alter user system default tablespace SYSTEM;
alter user system temporary tablespace TEMP;
spool off
rem 脚本结束
7、执行脚本
您可以进行执行脚本了,转到目录:$ORACLE_HOME/dbs中去,并且将上面的create_db.sql也放到此目录中,下面开始了:
键入命令:svrmgrl回车
SVRMGR>connect internal
connected.
SVRMGR>startup回车
SVRMGR>@create_db.sql回车(ok,下面您就可以看到屏幕在不断的显时操作过程,大概需要半个多小时的时间或许还要长一点点)。
执行完毕之后您可能需要退出去
SVRMGR>exit
没有错误的话,现在您的数据库已经生成了。
8、生成SQL*Plus帮助系统
sqlplus SYSTEM/manager
@/data/ora816/sqlplus/admin/help/helpbld.sql helpus.sql
9、部分说明
1)、create database web
datafile '$ORACLE_HOME/oradata/web/web_syst_01.dbf' size 500M reuse
logfile
'$ORACLE_HOME/oradata/web/web_redo_01.dbf' size 10M reuse,
'$ORACLE_HOME/oradata/web/web_redo_02.dbf' size 10M reuse,
'$ORACLE_HOME/oradata/web/web_redo_03.dbf' size 10M reuse
请注重看一下生成的文件名字:web_syst_01.dbf,web_redo_01.dbf,web_redo_02.dbf,web_redo_03.dbf,请注重将您的sid换成相应的部分,在我的例子中我的sid是web。
另外还有生成表空间时的几个文件:
create tablespace rollback
datafile '$ORACLE_HOME/dbs/web_roll_01.dbf' size 8M reuse;
create tablespace temp
datafile '$ORACLE_HOME/dbs/web_temp_01.dbf' size 5M reuse
temporary;
create tablespace users
datafile '$ORACLE_HOME/dbs/web_user_01.dbf' size 10M reuse;
最好也要改成相应的名字
2)、connect system/manager
@$ORACLE_HOME/rdbms/admin/catdbsyn.sql
connect internal
@$ORACLE_HOME/rdbms/admin/catproc.sql
connect system/manager
@$ORACLE_HOME/sqlplus/admin/pupbld.sql
其中的connect system/manager 是假设您的system账号的密码就是manager(系统默认的),假如您通过alter user system identified by 修改了密码,请换成正确的密码登录。
3)、initweb.ora文件内容:
db_name = "web"
instance_name = web
service_names = web.edi.com
db_files = 1024
control_files = ("/data/ora816/oradata/web/control01.ctl", "/data/ora816/oradata/web/control02.ctl", "/d
ata/ora816/oradata/web/control03.ctl")
open_cursors = 200
max_enabled_roles = 30
db_file_multiblock_read_count = 8
db_block_buffers = 4096
shared_pool_size = 52428800
large_pool_size = 78643200
java_pool_size = 20971520
log_checkpoint_interval = 10000
log_checkpoint_timeout = 1800
processes = 115
parallel_max_servers = 5
log_buffer = 32768
max_dump_file_size = 10240
global_names = true
oracle_trace_collection_name = ""
background_dump_dest = /data/ora816/admin/web/bdump
user_dump_dest = /data/ora816/admin/web/udump
db_block_size = 16384
remote_login_passWordfile = exclusive
os_authent_prefix = ""
job_queue_processes = 4
job_queue_interval = 60
open_links = 4
distributed_transactions = 10
mts_dispatchers = "(PROTOCOL=TCP)(PRE=oracle.aurora.server.SGiopServer)"
mts_dispatchers = "(protocol=TCP)"
compatible = 8.1.0
sort_area_size = 65536
sort_area_retained_size = 65536
# log_archive_start = true
# log_archive_dest_1 = "location=/data/ora816/oradata/oradb/archive"
# log_archive_format = %%ORACLE_SID%%T%TS%S.ARC
-------------
Excellent work!
Some additions:
7. after connect as internal, you should run your creat_db.sql. (delete that part: startup).
9- 3). In the initweb.ora, you should add rollback_segments = ( RBS0