RHEL 6.5環境Oracle 11g R2手工建庫指令碼(create database manually)
createdb.sh
******************************************************************************************************
#!/bin/sh
rm -rf /u01/app/oracle/{oradata/ORCL,admin/ORCL/{{a,dp}dump,scripts,pfile},fast_recovery_area/ORCL/archivelog}
mkdir -p /u01/app/oracle/{oradata/ORCL,admin/ORCL/{{a,dp}dump,script,pfile},fast_recovery_area/ORCL/archivelog}
export ORACLE_SID=ORCL;
export PATH=$ORACLE_HOME/bin:$PATH;
echo You should Add this entry in the /etc/oratab: ORCL:/u01/app/oracle/product/11.2.0/dbhome_1:Y
/u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus /nolog @createdb.sql
******************************************************************************************************
createdb.sql
******************************************************************************************************
set verify off
PROMPT specify a password for sys as parameter 1;
DEFINE sysPassword = &1
PROMPT specify a password for system as parameter 2;
DEFINE systemPassword = &2
host /u01/app/oracle/product/11.2.0/dbhome_1/bin/orapwd file=?/dbs/orapwORCL password=&&sysPassword entries=30 force=y
@CreateDB.sql
@CreateDBFiles.sql
@CreateDBCatalog.sql
@lockAccount.sql
@postDBCreation.sql
CreateDB.sql
******************************************************************************************************
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/cfgtoollogs/CreateDB.log
startup nomount pfile="/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initORCL.ora";
CREATE DATABASE "ORCL"
MAXINSTANCES 8
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
DATAFILE '/u01/app/oracle/oradata/ORCL/system01.dbf' SIZE 300M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/app/oracle/oradata/ORCL/sysaux01.dbf' SIZE 120M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/app/oracle/oradata/ORCL/temp01.dbf' SIZE 20M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/u01/app/oracle/oradata/ORCL/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/ORCL/redo01.dbf') SIZE 51200K,
GROUP 2 ('/u01/app/oracle/oradata/ORCL/redo02.dbf') SIZE 51200K,
GROUP 3 ('/u01/app/oracle/oradata/ORCL/redo03.dbf') SIZE 51200K
USER SYS IDENTIFIED BY "&&sysPassword" USER SYSTEM IDENTIFIED BY "&&systemPassword";
spool off
******************************************************************************************************
CreateDBFiles.sql
******************************************************************************************************
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/cfgtoollogs/CreateDBFiles.log
CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE '/u01/app/oracle/oradata/ORCL/users01.dbf' SIZE 5M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
ALTER DATABASE DEFAULT TABLESPACE "USERS";
spool off
******************************************************************************************************
CreateDBCatalog.sql
******************************************************************************************************
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/cfgtoollogs/CreateDBCatalog.log
@/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catalog.sql;
@/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catblock.sql;
@/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catproc.sql;
@/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catoctk.sql;
@/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/owminst.plb;
connect "SYSTEM"/"&&systemPassword"
@/u01/app/oracle/product/11.2.0/dbhome_1/sqlplus/admin/pupbld.sql;
connect "SYSTEM"/"&&systemPassword"
set echo on
spool /u01/app/oracle/cfgtoollogs/sqlPlusHelp.log
@/u01/app/oracle/product/11.2.0/dbhome_1/sqlplus/admin/help/hlpbld.sql helpus.sql;
spool off
spool off
******************************************************************************************************
lockAccount.sql
******************************************************************************************************
set echo on
spool /u01/app/oracle/cfgtoollogs/lockAccount.log
BEGIN
FOR item IN (SELECT USERNAME FROM DBA_USERS WHERE USERNAME NOT IN ('SYS','SYSTEM'))
LOOP
dbms_output.put_line('Locking and Expiring:' || item.USERNAME);
execute immediate 'alter user' || item.USERNAME || 'password expire account lock';
END LOOP;
END;
/
spool off
******************************************************************************************************
postDBCreation.sql
******************************************************************************************************
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/cfgtoollogs/postDBCreation.log
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
create spfile='?/dbs/spfileORCL.ora' FROM pfile='?/dbs/initORCL.ora';
shutdown immediate;
connect "SYS"/"&&sysPassword" as SYSDBA
startup ;
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;
connect "SYS"/"&&sysPassword" as SYSDBA
spool /u01/app/oracle/cfgtoollogs/postDBCreation.log
exit;
******************************************************************************************************
initORCL.ora
******************************************************************************************************
##############################################################################
# Copyright (c) 1991, 2001, 2002 by Oracle Corporation
##############################################################################
###########################################
# Cache and I/O
###########################################
db_block_size=8192
###########################################
# Cursors and Library Cache
###########################################
open_cursors=300
###########################################
# Database Identification
###########################################
db_domain=''
db_name=ORCL
###########################################
# File Configuration
###########################################
control_files=("/u01/app/oracle/oradata/ORCL/control01.dbf","/u01/app/oracle/oradata/ORCL/control02.dbf","/u01/app/oracle/oradata/ORCL/control03.dbf")
db_recovery_file_dest=/u01/app/oracle/fast_recovery_area
db_recovery_file_dest_size=2147483648
###########################################
# Miscellaneous
###########################################
compatible='11.2.0'
diagnostic_dest=/u01/app/oracle/admin/ORCL
###########################################
# Processes and Sessions
###########################################
processes=150
sessions=115
###########################################
# SGA Memory
###########################################
sga_target=402653184
###########################################
# Security and Auditing
###########################################
audit_file_dest=/u01/app/oracle/admin/ORCL/adump
audit_trail=db
remote_login_passwordfile=EXCLUSIVE
###########################################
# Sort, Hash Joins, Bitmap Indexes
###########################################
pga_aggregate_target=134217728
###########################################
# System Managed Undo and Rollback Segments
###########################################
undo_tablespace=UNDOTBS1
******************************************************************************************************
******************************************************************************************************
#!/bin/sh
rm -rf /u01/app/oracle/{oradata/ORCL,admin/ORCL/{{a,dp}dump,scripts,pfile},fast_recovery_area/ORCL/archivelog}
mkdir -p /u01/app/oracle/{oradata/ORCL,admin/ORCL/{{a,dp}dump,script,pfile},fast_recovery_area/ORCL/archivelog}
export ORACLE_SID=ORCL;
export PATH=$ORACLE_HOME/bin:$PATH;
echo You should Add this entry in the /etc/oratab: ORCL:/u01/app/oracle/product/11.2.0/dbhome_1:Y
/u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus /nolog @createdb.sql
******************************************************************************************************
createdb.sql
******************************************************************************************************
set verify off
PROMPT specify a password for sys as parameter 1;
DEFINE sysPassword = &1
PROMPT specify a password for system as parameter 2;
DEFINE systemPassword = &2
host /u01/app/oracle/product/11.2.0/dbhome_1/bin/orapwd file=?/dbs/orapwORCL password=&&sysPassword entries=30 force=y
@CreateDB.sql
@CreateDBFiles.sql
@CreateDBCatalog.sql
@lockAccount.sql
@postDBCreation.sql
**************************************************************************************************************************************************
CreateDB.sql
******************************************************************************************************
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/cfgtoollogs/CreateDB.log
startup nomount pfile="/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initORCL.ora";
CREATE DATABASE "ORCL"
MAXINSTANCES 8
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
DATAFILE '/u01/app/oracle/oradata/ORCL/system01.dbf' SIZE 300M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/app/oracle/oradata/ORCL/sysaux01.dbf' SIZE 120M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/app/oracle/oradata/ORCL/temp01.dbf' SIZE 20M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/u01/app/oracle/oradata/ORCL/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/ORCL/redo01.dbf') SIZE 51200K,
GROUP 2 ('/u01/app/oracle/oradata/ORCL/redo02.dbf') SIZE 51200K,
GROUP 3 ('/u01/app/oracle/oradata/ORCL/redo03.dbf') SIZE 51200K
USER SYS IDENTIFIED BY "&&sysPassword" USER SYSTEM IDENTIFIED BY "&&systemPassword";
spool off
******************************************************************************************************
CreateDBFiles.sql
******************************************************************************************************
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/cfgtoollogs/CreateDBFiles.log
CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE '/u01/app/oracle/oradata/ORCL/users01.dbf' SIZE 5M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
ALTER DATABASE DEFAULT TABLESPACE "USERS";
spool off
******************************************************************************************************
CreateDBCatalog.sql
******************************************************************************************************
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/cfgtoollogs/CreateDBCatalog.log
@/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catalog.sql;
@/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catblock.sql;
@/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catproc.sql;
@/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catoctk.sql;
@/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/owminst.plb;
connect "SYSTEM"/"&&systemPassword"
@/u01/app/oracle/product/11.2.0/dbhome_1/sqlplus/admin/pupbld.sql;
connect "SYSTEM"/"&&systemPassword"
set echo on
spool /u01/app/oracle/cfgtoollogs/sqlPlusHelp.log
@/u01/app/oracle/product/11.2.0/dbhome_1/sqlplus/admin/help/hlpbld.sql helpus.sql;
spool off
spool off
******************************************************************************************************
lockAccount.sql
******************************************************************************************************
set echo on
spool /u01/app/oracle/cfgtoollogs/lockAccount.log
BEGIN
FOR item IN (SELECT USERNAME FROM DBA_USERS WHERE USERNAME NOT IN ('SYS','SYSTEM'))
LOOP
dbms_output.put_line('Locking and Expiring:' || item.USERNAME);
execute immediate 'alter user' || item.USERNAME || 'password expire account lock';
END LOOP;
END;
/
spool off
******************************************************************************************************
postDBCreation.sql
******************************************************************************************************
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/cfgtoollogs/postDBCreation.log
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
create spfile='?/dbs/spfileORCL.ora' FROM pfile='?/dbs/initORCL.ora';
shutdown immediate;
connect "SYS"/"&&sysPassword" as SYSDBA
startup ;
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;
connect "SYS"/"&&sysPassword" as SYSDBA
spool /u01/app/oracle/cfgtoollogs/postDBCreation.log
exit;
******************************************************************************************************
initORCL.ora
******************************************************************************************************
##############################################################################
# Copyright (c) 1991, 2001, 2002 by Oracle Corporation
##############################################################################
###########################################
# Cache and I/O
###########################################
db_block_size=8192
###########################################
# Cursors and Library Cache
###########################################
open_cursors=300
###########################################
# Database Identification
###########################################
db_domain=''
db_name=ORCL
###########################################
# File Configuration
###########################################
control_files=("/u01/app/oracle/oradata/ORCL/control01.dbf","/u01/app/oracle/oradata/ORCL/control02.dbf","/u01/app/oracle/oradata/ORCL/control03.dbf")
db_recovery_file_dest=/u01/app/oracle/fast_recovery_area
db_recovery_file_dest_size=2147483648
###########################################
# Miscellaneous
###########################################
compatible='11.2.0'
diagnostic_dest=/u01/app/oracle/admin/ORCL
###########################################
# Processes and Sessions
###########################################
processes=150
sessions=115
###########################################
# SGA Memory
###########################################
sga_target=402653184
###########################################
# Security and Auditing
###########################################
audit_file_dest=/u01/app/oracle/admin/ORCL/adump
audit_trail=db
remote_login_passwordfile=EXCLUSIVE
###########################################
# Sort, Hash Joins, Bitmap Indexes
###########################################
pga_aggregate_target=134217728
###########################################
# System Managed Undo and Rollback Segments
###########################################
undo_tablespace=UNDOTBS1
******************************************************************************************************
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9034054/viewspace-1979956/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Create database manuallyDatabase
- oracle-手工建庫指令碼Oracle指令碼
- oracle 11g手工建庫Oracle
- (一)在Unix下Oracle 11g 建庫指令碼 bsb_oracle_create_db.shOracle指令碼
- Oracle 11g 安裝環境配置指令碼Oracle指令碼
- RHEL 6.5 64位安裝ORACLE 11G R2 Grid Infrastructure for a Standalone ServerOracleASTStructServer
- (二)在Unix下Oracle 11g 建庫指令碼 bsb_oracle_create_db.sh 備機同步及HA指令碼生成Oracle指令碼
- 【oracle手工建庫】Oracle
- oracle手工建庫Oracle
- OEL6下ORACLE 11g手工建庫Oracle
- How to drop Oracle RAC database manually?OracleDatabase
- Oracle 11g r2基於OMF方式手工建立資料庫Oracle資料庫
- oracle建庫指令碼Oracle指令碼
- Oracle 11g R2(11.2.0.3.0) RAC環境搭建(二)Oracle
- Oracle Database 11g 環境搭建--先決步驟OracleDatabase
- oracle 10 手工建庫Oracle
- Oracle 9 手工建庫Oracle
- Oracle手工建庫指南Oracle
- RHEL5 Oracle 11G R2 RAC 靜默安裝 (三) rdbms安裝 dbca 建庫Oracle
- CENTOS 6.6 x64 自動化安裝Oracle Database 11g R2 RAC指令碼CentOSOracleDatabase指令碼
- vue 構建環境切換指令碼Vue指令碼
- RHEL 6.2 64位安裝ORACLE 11G R2Oracle
- Oracle 9 手工建庫(轉)Oracle
- 【CREATE DATABASE】因缺失單引號導致手工建庫命令執行報錯的故障排查Database
- rhel 5.4 64位上安裝oracle 11g R2Oracle
- Oracle 11g R2 RAC安裝前的系統環境搭建Oracle
- Oracle 10g手工建庫Oracle 10g
- Oracle10g 手工建庫Oracle
- CentOS 6.5 Oracle 環境變數設定CentOSOracle變數
- 【手工建庫】手工方式建立 ORACLE資料庫全程記錄Oracle資料庫
- 手工建立ORACLE 11g 資料庫Oracle資料庫
- Oracle安裝前的環境配置指令碼Oracle指令碼
- Oracle生產環境RMAN備份指令碼Oracle指令碼
- 手工建庫
- win7 下手工建oracle庫Win7Oracle
- 手工建立(Create)一個Oracle 10g資料庫Oracle 10g資料庫
- 水煮oracle28----oracle手工建庫步驟Oracle
- Oracle 10g 安裝環境配置指令碼Oracle 10g指令碼