(一)在Unix下Oracle 11g 建庫指令碼 bsb_oracle_create_db.sh
使用該建庫指令碼前,請理解指令碼內容.
-
echo "#==========================Create DB===============================#"
-
date
-
echo "#==========================Create DB===============================#"
-
-
#------------------------------------------------------#
-
# 手工建庫
-
# 以oracle使用者執行該指令碼
-
#------------------------------------------------------#
-
ORACLE_SID=bjtc
-
export ORACLE_UNQNAME=bjtc
-
export ORACLE_HOSTNAME=BJTC
-
ORACLE_BASE=/oracle/product
-
ORACLE_HOME=$ORACLE_BASE/11.2.3
-
-
#--修改.profile
-
cd ~
-
cat >> ~/.profile <<EOF
-
#-----------------------------------------#
-
# add for oracle
-
export ORACLE_SID=bjtc
-
export ORACLE_UNQNAME=bjtc
-
export ORACLE_HOSTNAME=BJTC
-
export ORACLE_BASE=/oracle/product
-
export ORACLE_HOME=$ORACLE_BASE/11.2.3
-
export PATH=$ORACLE_HOME/bin:$PATH
-
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
-
export NLS_DATE_FORMAT="yy-mm-dd HH24:MI:SS"
-
export NLS_LANG=American_America.ZHS16GBK
-
#-----------------------------------------#
-
set -o vi
-
alias ll='ls -l'
-
EOF
-
-
. .profile
-
-
#------------------------------------------------------#
-
#--生成建庫配置檔案 dbca.rsp
-
#------------------------------------------------------#
-
cat > /oracle/dbca.rsp <<EOF
-
[GENERAL]
-
RESPONSEFILE_VERSION = "11.2.0"
-
OPERATION_TYPE = "createDatabase"
-
-
[CREATEDATABASE]
-
GDBNAME = "$ORACLE_SID"
-
SID = "$ORACLE_SID"
-
TEMPLATENAME = "General_Purpose.dbc"
-
SYSPASSWORD = "Bsbora12#"
-
SYSTEMPASSWORD = "Bsbora12#"
-
EMCONFIGURATION = "NONE"
-
SYSMANPASSWORD = "Bsbora12#"
-
DBSNMPPASSWORD = "Bsbora12#"
-
DATAFILEDESTINATION = /oradata
-
#STORAGETYPE=FS
-
CHARACTERSET = "ZHS16GBK"
-
NATIONALCHARACTERSET= "AL16UTF16"
-
LISTENERS = "listener"
-
MEMORYPERCENTAGE = "40"
-
DATABASETYPE = "MULTIPURPOSE"
-
AUTOMATICMEMORYMANAGEMENT = "TRUE"
-
#TOTALMEMORY = "800"
-
EOF
-
-
cd $ORACLE_HOME/bin
-
./dbca -silent -createdatabase -responseFile /oracle/dbca.rsp
-
sleep 5
-
-
#------------------------------------------------------#
-
# 手工建庫後需要執行的語句
-
#------------------------------------------------------#
-
echo "col file_name for a50" >> $ORACLE_HOME/sqlplus/admin/glogin.sql
-
echo "col member for a50" >> $ORACLE_HOME/sqlplus/admin/glogin.sql
-
echo "set lines 200" >> $ORACLE_HOME/sqlplus/admin/glogin.sql
-
echo "set pages 100" >> $ORACLE_HOME/sqlplus/admin/glogin.sql
-
-
mkdir /oraredo1/$ORACLE_SID
-
mkdir /oraredo2/$ORACLE_SID
-
-
sqlplus / as sysdba << EOF
-
shutdown immediate;
-
EOF
-
-
#--spfile放在儲存
-
echo "spfile=/oradata/$ORACLE_SID/spfile$ORACLE_SID.ora" > $ORACLE_HOME/dbs/init$ORACLE_SID.ora
-
mv $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora /oradata/$ORACLE_SID
-
-
sqlplus / as sysdba << EOF
-
startup mount;
-
alter database archivelog;
-
alter system set log_archive_dest_1='location=/archivelog';
-
alter database open;
-
-
alter profile default limit password_life_time unlimited;
-
alter system set processes=1500 scope=spfile;
-
alter system set open_cursors=1000 scope=spfile;
-
-
alter system set db_recovery_file_dest='';
-
alter database datafile 1 resize 4096m;
-
alter database datafile 2 resize 4096m;
-
alter database datafile 3 resize 20480m;
-
alter database datafile 4 resize 1024m;
-
alter database tempfile 1 resize 20480m;
-
-
alter database add logfile group 4 ( '/oraredo1/$ORACLE_SID/redo041.log','/oraredo2/$ORACLE_SID/redo042.log') size 256M;
-
alter database add logfile group 5 ( '/oraredo1/$ORACLE_SID/redo051.log','/oraredo2/$ORACLE_SID/redo052.log') size 256M;
-
alter database add logfile group 6 ( '/oraredo1/$ORACLE_SID/redo061.log','/oraredo2/$ORACLE_SID/redo062.log') size 256M;
-
alter database add logfile group 7 ( '/oraredo1/$ORACLE_SID/redo071.log','/oraredo2/$ORACLE_SID/redo072.log') size 256M;
-
alter database add logfile group 8 ( '/oraredo1/$ORACLE_SID/redo081.log','/oraredo2/$ORACLE_SID/redo082.log') size 256M;
-
alter database add logfile group 9 ( '/oraredo1/$ORACLE_SID/redo091.log','/oraredo2/$ORACLE_SID/redo092.log') size 256M;
-
alter database add logfile group 10 ( '/oraredo1/$ORACLE_SID/redo1001.log','/oraredo2/$ORACLE_SID/redo1002.log') size 256M;
-
-
alter system switch logfile;
-
!sleep 3
-
alter system switch logfile;
-
!sleep 3
-
alter system switch logfile;
-
!sleep 3
-
alter system switch logfile;
-
!sleep 3
-
alter system switch logfile;
-
!sleep 3
-
alter system switch logfile;
-
!sleep 3
-
alter system switch logfile;
-
-
select group#,status,BYTES from v\$log;
-
select group#,status,member from v\$logfile;
-
-
alter database drop logfile group 1;
-
alter database drop logfile group 2;
-
alter database drop logfile group 3;
-
alter database add logfile group 1 ( '/oraredo1/$ORACLE_SID/redo011.log','/oraredo2/$ORACLE_SID/redo012.log') size 256M;
-
alter database add logfile group 2 ( '/oraredo1/$ORACLE_SID/redo021.log','/oraredo2/$ORACLE_SID/redo022.log') size 256M;
-
alter database add logfile group 3 ( '/oraredo1/$ORACLE_SID/redo031.log','/oraredo2/$ORACLE_SID/redo032.log') size 256M;
-
-
alter system set control_files='/oradata/$ORACLE_SID/control01.ctl','/oradata/$ORACLE_SID/control02.ctl' scope=spfile;
-
shutdown immediate;
-
! cp /oradata/$ORACLE_SID/control01.ctl /oradata/$ORACLE_SID/control02.ctl
-
startup;
-
alter user sysman account unlock;
-
EOF
-
-
echo "#==========================End Create DB===============================#"
-
date
-
echo "#==========================End Create DB===============================#"
-
-
cat > $ORACLE_HOME/network/admin/listener.ora << EOF
-
SID_LIST_LISTENER =
-
(SID_LIST =
-
(SID_DESC =
-
(SID_NAME = PLSExtProc)
-
(ORACLE_HOME = /oracle/product/11.2.3)
-
(PROGRAM = extproc)
-
)
-
(SID_DESC =
-
(SID_NAME = $ORACLE_SID )
-
(ORACLE_HOME = /oracle/product/11.2.3)
-
(GLOBAL_DBNAME = $ORACLE_UNQNAME )
-
)
-
)
-
-
LISTENER =
-
(DESCRIPTION_LIST =
-
(DESCRIPTION =
-
(ADDRESS = (PROTOCOL = TCP)(HOST = $ORACLE_HOSTNAME )(PORT = 1521))
-
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
-
)
-
)
- EOF
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22661144/viewspace-1429920/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- (二)在Unix下Oracle 11g 建庫指令碼 bsb_oracle_create_db.sh 備機同步及HA指令碼生成Oracle指令碼
- UNIX下oracle啟動指令碼Oracle指令碼
- oracle建庫指令碼Oracle指令碼
- 在Suse Linux下 Oracle 11g 建庫指令碼-準備檔案系統及使用者oracleLinuxOracle指令碼
- 建庫指令碼下載指令碼
- oracle-手工建庫指令碼Oracle指令碼
- windows和unix平臺下Oracle冷備份指令碼WindowsOracle指令碼
- OEL6下ORACLE 11g手工建庫Oracle
- oracle 11g手工建庫Oracle
- unix、linux oracle rman匯出指令碼LinuxOracle指令碼
- Oracle 11g Rac清理指令碼Oracle指令碼
- RHEL 6.5環境Oracle 11g R2手工建庫指令碼(create database manually)Oracle指令碼Database
- 透過oracle的指令碼研究其建庫過程Oracle指令碼
- 通過oracle的指令碼研究其建庫過程Oracle指令碼
- 【Oracle指令碼】-很不錯的Windows下資料庫備份EXP指令碼Oracle指令碼Windows資料庫
- oracle 11g監控SQL指令碼OracleSQL指令碼
- unix下幾個有用的小shell指令碼(轉)指令碼
- Unix命令列程式和內建指令命令列
- 在Oracle 9i下的display_cursor指令碼Oracle指令碼
- 在UNIX環境下批次殺掉ORACLE程式Oracle
- Oracle 11g Data Guard 備庫歸檔日誌清理指令碼(保留一週歸檔)Oracle指令碼
- 建庫和表的指令碼.sql指令碼SQL
- Oracle 11g 統計資訊收集指令碼Oracle指令碼
- 在Windows 10系統下安裝Oracle 11g資料庫WindowsOracle資料庫
- Oracle資料庫管理指令碼介紹 (RDBMS目錄下)Oracle資料庫指令碼
- Oracle 11g 安裝環境配置指令碼Oracle指令碼
- Oracle 11g RMAN multiplexing 備份指令碼Oracle指令碼
- Linux/Unix shell 指令碼中呼叫SQL,RMAN指令碼Linux指令碼SQL
- 【配置上線】Oracle靜默建庫 for 11gOracle
- 在Oracle Linux 6.6下安裝Oracle 11gOracleLinux
- windows下oracle資料庫的exp自動備份指令碼WindowsOracle資料庫指令碼
- 【指令碼】UNIX平臺orainstRoot.sh指令碼作用指令碼AI
- windows下Oracle11G指令碼建使用者、表空間、表WindowsOracle指令碼
- oracle 11g RAC 安裝前準備指令碼Oracle指令碼
- 指令碼建立Oracle的資料庫指令碼Oracle資料庫
- 理解 Linux/Unix 登入指令碼Linux指令碼
- UNIX crontab自動執行指令碼指令碼
- 轉貼:RMAN備份指令碼(Unix)指令碼