安装完软件后,通过dbca建库,实例名是abc,相关内容如下:
建库脚本默认保留在 c:\app\administrator\admin\abc\scripts\目录下。
abc.bat文件:
old_umask=`umask`
umask 0027
mkdir c:\app\administrator\admin\abc\adump
mkdir c:\app\administrator\admin\abc\dpdump
mkdir c:\app\administrator\admin\abc\pfile
mkdir c:\app\administrator\cfgtoollogs\dbca\abc
mkdir c:\app\administrator\flash_recovery_area
mkdir c:\app\administrator\flash_recovery_area\abc
mkdir c:\app\administrator\oradata\abc
mkdir c:\app\administrator\product\11.2.0\dbhome_1\database
umask ${old_umask}
set oracle_sid=abc
set path=%oracle_home%\bin;%path%
c:\app\administrator\product\11.2.0\dbhome_1\bin\oradim.exe -new -sid abc -startmode manual -spfile
c:\app\administrator\product\11.2.0\dbhome_1\bin\oradim.exe -edit -sid abc -startmode auto -srvcstart system
c:\app\administrator\product\11.2.0\dbhome_1\bin\sqlplus /nolog @c:\app\administrator\admin\abc\scripts\abc.sql
abc.sql文件:
set verify off
accept syspassword char prompt 'enter new password for sys: ' hide
accept systempassword char prompt 'enter new password for system: ' hide
host c:\app\administrator\product\11.2.0\dbhome_1\bin\orapwd.exe file=c:\app\administrator\product\11.2.0\dbhome_1\database\pwdabc.ora force=y
@c:\app\administrator\admin\abc\scripts\clonermanrestore.sql
@c:\app\administrator\admin\abc\scripts\clonedbcreation.sql
@c:\app\administrator\admin\abc\scripts\postscripts.sql
@c:\app\administrator\admin\abc\scripts\lockaccount.sql
@c:\app\administrator\admin\abc\scripts\postdbcreation.sql
clonermanrestore.sql
set verify off
connect "sys"/"&&syspassword" as sysdba
set echo on
spool c:\app\administrator\admin\abc\scripts\clonermanrestore.log append
startup nomount pfile="c:\app\administrator\admin\abc\scripts\init.ora";
@c:\app\administrator\admin\abc\scripts\rmanrestoredatafiles.sql;
spool off
clonermanrestore.sql
set verify off
connect "sys"/"&&syspassword" as sysdba
set echo on
spool c:\app\administrator\admin\abc\scripts\clonedbcreation.log append
create controlfile reuse set database "abc"
maxinstances 8
maxloghistory 1
maxlogfiles 16
maxlogmembers 3
maxdatafiles 100
datafile
'c:\app\administrator\oradata\abc\system01.dbf',
'c:\app\administrator\oradata\abc\sysaux01.dbf',
'c:\app\administrator\oradata\abc\undotbs01.dbf',
'c:\app\administrator\oradata\abc\users01.dbf'
logfile group 1 ('c:\app\administrator\oradata\abc\redo01.log') size 51200k,
group 2 ('c:\app\administrator\oradata\abc\redo02.log') size 51200k,
group 3 ('c:\app\administrator\oradata\abc\redo03.log') size 51200k resetlogs;
exec dbms_backup_restore.zerodbid(0);
shutdown immediate;
startup nomount pfile="c:\app\administrator\admin\abc\scripts\initabctemp.ora";
create controlfile reuse set database "abc"
maxinstances 8
maxloghistory 1
maxlogfiles 16
maxlogmembers 3
maxdatafiles 100
datafile
'c:\app\administrator\oradata\abc\system01.dbf',
'c:\app\administrator\oradata\abc\sysaux01.dbf',
'c:\app\administrator\oradata\abc\undotbs01.dbf',
'c:\app\administrator\oradata\abc\users01.dbf'
logfile group 1 ('c:\app\administrator\oradata\abc\redo01.log') size 51200k,
group 2 ('c:\app\administrator\oradata\abc\redo02.log') size 51200k,
group 3 ('c:\app\administrator\oradata\abc\redo03.log') size 51200k resetlogs;
alter system enable restricted session;
alter database "abc" open resetlogs;
exec dbms_service.delete_service('seeddata');
exec dbms_service.delete_service('seeddataxdb');
alter database rename global_name to "abc";
alter tablespace temp add tempfile 'c:\app\administrator\oradata\abc\temp01.dbf' size 20480k reuse autoextend on next 640k maxsize unlimited;
select tablespace_name from dba_tablespaces where tablespace_name='users';
alter system disable restricted session;
connect "sys"/"&&syspassword" as sysdba
@c:\app\administrator\product\11.2.0\dbhome_1\demo\schema\mkplug.sql &&syspassword change_on_install change_on_install change_on_install change_on_install change_on_install change_on_install c:\app\administrator\product\11.2.0\dbhome_1\assistants\dbca\templates\example.dmp c:\app\administrator\product\11.2.0\dbhome_1\assistants\dbca\templates\example01.dfb c:\app\administrator\oradata\abc\example01.dbf c:\app\administrator\admin\abc\scripts\ "'sys/&&syspassword as sysdba'";
connect "sys"/"&&syspassword" as sysdba
shutdown immediate;
connect "sys"/"&&syspassword" as sysdba
startup restrict pfile="c:\app\administrator\admin\abc\scripts\initabctemp.ora";
select sid, program, serial#, username from v$session;
alter database character set internal_convert al32utf8;
alter database national character set internal_convert al16utf16;
alter user sys account unlock identified by "&&syspassword";
alter user system account unlock identified by "&&systempassword";
alter system disable restricted session;
postscripts.sql
set verify off
connect "sys"/"&&syspassword" as sysdba
set echo on
spool c:\app\administrator\admin\abc\scripts\postscripts.log append
@c:\app\administrator\product\11.2.0\dbhome_1\rdbms\admin\dbmssml.sql;
execute dbms_datapump_utl.replace_default_dir;
commit;
connect "sys"/"&&syspassword" as sysdba
alter session set current_schema=ordsys;
@c:\app\administrator\product\11.2.0\dbhome_1\ord\im\admin\ordlib.sql;
alter session set current_schema=sys;
connect "sys"/"&&syspassword" as sysdba
alter user ctxsys account unlock identified by &&syspassword;
connect "ctxsys"/"&&syspassword"
@c:\app\administrator\product\11.2.0\dbhome_1\ctx\admin\defaults\dr0defdp.sql;
@c:\app\administrator\product\11.2.0\dbhome_1\ctx\admin\defaults\dr0defin.sql "simplified chinese";
connect "sys"/"&&syspassword" as sysdba
alter user ctxsys password expire account lock;
connect "sys"/"&&syspassword" as sysdba
execute oracle_ocm.mgmt_config_utl.create_replace_dir_obj;
lockaccount.sql
set verify off
set echo on
spool c:\app\administrator\admin\abc\scripts\lockaccount.log append
begin
for item in ( select username from dba_users where account_status in ('open', 'locked', 'expired') and username not in (
'sys','system') )
loop
dbms_output.put_line('locking and expiring: ' || item.username);
execute immediate 'alter user ' ||
sys.dbms_assert.enquote_name(
sys.dbms_assert.schema_name(
item.username),false) || ' password expire account lock' ;
end loop;
end;
/
spool off
postdbcreation.sql
set verify off
connect "sys"/"&&syspassword" as sysdba
set echo on
spool c:\app\administrator\admin\abc\scripts\postdbcreation.log append
select 'utl_recomp_begin: ' || to_char(sysdate, 'hh:mi:ss') from dual;
execute utl_recomp.recomp_serial();
select 'utl_recomp_end: ' || to_char(sysdate, 'hh:mi:ss') from dual;
execute dbms_swrf_internal.cleanup_database(cleanup_local => false);
commit;
connect "sys"/"&&syspassword" as sysdba
set echo on
create spfile='c:\app\administrator\product\11.2.0\dbhome_1\database\spfileabc.ora' from pfile='c:\app\administrator\admin\abc\scripts\init.ora';
shutdown immediate;
connect "sys"/"&&syspassword" as sysdba
startup ;
spool off
exit;
init.ora文件
##############################################################################
# 凯发app官方网站 copyright (c) 1991, 2001, 2002 by oracle corporation
##############################################################################
###########################################
# nls
###########################################
nls_language="simplified chinese"
nls_territory="china"
###########################################
# shared server
###########################################
dispatchers="(protocol=tcp) (service=abcxdb)"
###########################################
# miscellaneous
###########################################
compatible=11.2.0.0.0
diagnostic_dest=c:\app\administrator
memory_target=854589440
###########################################
# security and auditing
###########################################
audit_file_dest=c:\app\administrator\admin\abc\adump
audit_trail=db
remote_login_passwordfile=exclusive
###########################################
# database identification
###########################################
db_domain=""
db_name=abc
###########################################
# file configuration
###########################################
control_files=("c:\app\administrator\oradata\abc\control01.ctl", "c:\app\administrator\flash_recovery_area\abc\control02.ctl")
db_recovery_file_dest=c:\app\administrator\flash_recovery_area
db_recovery_file_dest_size=4039114752
###########################################
# cursors and library cache
###########################################
open_cursors=300
###########################################
# system managed undo and rollback segments
###########################################
undo_tablespace=undotbs1
###########################################
# network registration
###########################################
#local_listener=listener_abc
###########################################
# processes and sessions
###########################################
processes=150
###########################################
# cache and i/o
###########################################
db_block_size=8192
initabctemp.ora文件
##############################################################################
# 凯发app官方网站 copyright (c) 1991, 2001, 2002 by oracle corporation
##############################################################################
###########################################
# nls
###########################################
nls_language="simplified chinese"
nls_territory="china"
###########################################
# shared server
###########################################
dispatchers="(protocol=tcp) (service=abcxdb)"
###########################################
# miscellaneous
###########################################
compatible=11.2.0.0.0
diagnostic_dest=c:\app\administrator
memory_target=854589440
###########################################
# security and auditing
###########################################
audit_file_dest=c:\app\administrator\admin\abc\adump
audit_trail=db
remote_login_passwordfile=exclusive
###########################################
# database identification
###########################################
db_domain=""
db_name=abc
###########################################
# file configuration
###########################################
control_files=("c:\app\administrator\oradata\abc\control01.ctl", "c:\app\administrator\flash_recovery_area\abc\control02.ctl")
db_recovery_file_dest=c:\app\administrator\flash_recovery_area
db_recovery_file_dest_size=4039114752
###########################################
# cursors and library cache
###########################################
open_cursors=300
###########################################
# system managed undo and rollback segments
###########################################
undo_tablespace=undotbs1
###########################################
# network registration
###########################################
#local_listener=listener_abc
###########################################
# processes and sessions
###########################################
processes=150
###########################################
# cache and i/o
###########################################
db_block_size=8192
_no_recovery_through_resetlogs=true
阅读(4602) | 评论(0) | 转发(0) |