OCM實驗-手工建庫
OCM實驗-手工建庫
檢查環境變數
[oracle@ocm1 ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
#以下是新增的環境變數
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=PROD
修改sqlplus的命令提示付
vi $ORACLE_HOME/sqlplus/admin/glogin.sql
將set sqlprompt"_user'@'_connect_identifier>"新增到檔案的最後
建立所需的目錄
mkdir -p $ORACLE_BASE/admin/PROD/adump
mkdir -p $ORACLE_BASE/admin/PROD/bdump
mkdir -p $ORACLE_BASE/admin/PROD/cdump
mkdir -p $ORACLE_BASE/admin/PROD/udump
mkdir -p $ORACLE_BASE/oradata/PROD/disk1
生成密碼檔案
[oracle@ocm1 ~]$ cd $ORACLE_HOME/dbs
[oracle@ocm1 dbs]$ orapwd help #不會命令時,可以這樣檢視
Usage: orapwd file= password= entries= force=
where
file - name of password file (mand),
password - password for SYS (mand),
entries - maximum number of distinct DBA and force - whether to overwrite existing file (opt),
OPERs (opt),
There are no spaces around the equal-to (=) character.
[oracle@ocm1 dbs]$ orapwd file=orapwPROD password=oracle entries=30
[oracle@ocm1 dbs]$ ls
initdw.ora init.ora orapwPROD
建立引數檔案
[oracle@ocm1 dbs]$ cat init.ora | grep -v ^# | grep -v ^$ > initPROD.ora
[oracle@ocm1 dbs]$ vi initPROD.ora
db_name=PROD
db_files = 80 # SMALL
db_file_multiblock_read_count = 8 # SMALL
#db_block_buffers = 100 # SMALL
#shared_pool_size = 3500000 # SMALL
log_checkpoint_interval = 10000
processes = 300 # SMALL
parallel_max_servers = 5 # SMALL
log_buffer = 32768 # SMALL
max_dump_file_size = 10240
global_names = FALSE
control_files = (/u01/app/oracle/oradata/PROD/disk1/control01.ctl, /u01/app/oracle/oradata/PROD/disk1/control02.ctl)
sga_max_size=500M
sga_target=500M
透過pfile檔案建立spfile
SYS@PROD>create spfile from pfile;
File created.
修改一些引數
SYS@PROD>show parameter undo;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string MANUAL
undo_retention integer 900
undo_tablespace string
SYS@PROD>
SYS@PROD>alter system set undo_management=auto scope=spfile;#將undo表空間設定為自動管理
System altered.
SYS@PROD>show parameter job;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
job_queue_processes integer 0
SYS@PROD>
SYS@PROD>alter system set job_queue_processes=30 scope=spfile;#開啟作業
System altered.
將資料庫重啟一下。
SYS@PROD>startup nomount
ORACLE instance started.
Total System Global Area 524288000 bytes
Fixed Size 1220384 bytes
Variable Size 146800864 bytes
Database Buffers 373293056 bytes
Redo Buffers 2973696 bytes
SYS@PROD>
檢查路徑引數
SYS@PROD>col name format a40
SYS@PROD>col value format a50
SYS@PROD>
SYS@PROD>select name,value from v$parameter where name like '%dest%';
NAME VALUE
---------------------------------------- --------------------------------------------------
。。。。。。
standby_archive_dest ?/dbs/arch
db_create_file_dest
db_create_online_log_dest_1
db_create_online_log_dest_2
db_create_online_log_dest_3
db_create_online_log_dest_4
db_create_online_log_dest_5
db_recovery_file_dest
db_recovery_file_dest_size 0
background_dump_dest /u01/app/oracle/admin/PROD/bdump
NAME VALUE
---------------------------------------- --------------------------------------------------
user_dump_dest /u01/app/oracle/admin/PROD/udump
core_dump_dest /u01/app/oracle/admin/PROD/cdump
audit_file_dest /u01/app/oracle/admin/PROD/adump
確認這些路徑已經建立
建立建庫指令碼
vi create_database.sql
CREATE DATABASE PROD
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/PROD/disk1/redo01.log') SIZE 100M,
GROUP 2 ('/u01/app/oracle/oradata/PROD/disk1/redo02.log') SIZE 100M,
GROUP 3 ('/u01/app/oracle/oradata/PROD/disk1/redo03.log') SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET AL16UTF16
DATAFILE '/u01/app/oracle/oradata/PROD/disk1/system01.dbf' SIZE 325M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE users
DATAFILE '/u01/app/oracle/oradata/PROD/disk1/users01.dbf' size 200M REUSE
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u01/app/oracle/oradata/PROD/disk1/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
開始執行
SYS@PROD>@create_database.sql
Database created.
開啟資料檔案的自動擴充套件。
SYS@PROD>alter database datafile 1 autoextend on;
Database altered.
SYS@PROD>alter database datafile 2 autoextend on;
Database altered.
SYS@PROD>alter database datafile 3 autoextend on;
Database altered.
SYS@PROD>alter database datafile 4 autoextend on;
Database altered.
執行指令碼
在sys使用者下執行
SYS@PROD>spool script.log
SYS@PROD>@?/rdbms/admin/catalog.sql
SYS@PROD>@?/rdbms/admin/catproc.sql
SYS@PROD>@?/rdbms/admin/catblock.sql
SYS@PROD>@?/rdbms/admin/catoctk.sql
SYS@PROD>@?/rdbms/admin/owminst.plb
在system使用者下執行
SYSTEM@PROD>@?/sqlplus/admin/help/hlpbld.sql
SYSTEM@PROD>@?/sqlplus/admin/help/helpus.sql
SYSTEM@PROD>@?/sqlplus/admin/pupbld.sql
下面是各個指令碼的解釋。
CATALOG.SQL
Creates the views of the data dictionary tables, the dynamic performance views, and public synonyms for many of the views. Grants PUBLIC access to the synonyms
CATPROC.SQL
Runs all scripts required for or used with PL/SQL.
catblock.sql
Creates views that can dynamically display lock dependency graphs
catoctk.sql
Creates the Oracle Cryptographic Toolkit package
owminst.plb
A Installing Workspace Manager with Custom Databases
http://docs.oracle.com/cd/B12037_01/appdev.101/b10824/long_inst.htm
pupbld.sql
help/hlpbld.sql
help/helpus.sql
sqlplus的幫助資訊
檢查環境變數
[oracle@ocm1 ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
#以下是新增的環境變數
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=PROD
修改sqlplus的命令提示付
vi $ORACLE_HOME/sqlplus/admin/glogin.sql
將set sqlprompt"_user'@'_connect_identifier>"新增到檔案的最後
建立所需的目錄
mkdir -p $ORACLE_BASE/admin/PROD/adump
mkdir -p $ORACLE_BASE/admin/PROD/bdump
mkdir -p $ORACLE_BASE/admin/PROD/cdump
mkdir -p $ORACLE_BASE/admin/PROD/udump
mkdir -p $ORACLE_BASE/oradata/PROD/disk1
生成密碼檔案
[oracle@ocm1 ~]$ cd $ORACLE_HOME/dbs
[oracle@ocm1 dbs]$ orapwd help #不會命令時,可以這樣檢視
Usage: orapwd file=
where
file - name of password file (mand),
password - password for SYS (mand),
entries - maximum number of distinct DBA and force - whether to overwrite existing file (opt),
OPERs (opt),
There are no spaces around the equal-to (=) character.
[oracle@ocm1 dbs]$ orapwd file=orapwPROD password=oracle entries=30
[oracle@ocm1 dbs]$ ls
initdw.ora init.ora orapwPROD
建立引數檔案
[oracle@ocm1 dbs]$ cat init.ora | grep -v ^# | grep -v ^$ > initPROD.ora
[oracle@ocm1 dbs]$ vi initPROD.ora
db_name=PROD
db_files = 80 # SMALL
db_file_multiblock_read_count = 8 # SMALL
#db_block_buffers = 100 # SMALL
#shared_pool_size = 3500000 # SMALL
log_checkpoint_interval = 10000
processes = 300 # SMALL
parallel_max_servers = 5 # SMALL
log_buffer = 32768 # SMALL
max_dump_file_size = 10240
global_names = FALSE
control_files = (/u01/app/oracle/oradata/PROD/disk1/control01.ctl, /u01/app/oracle/oradata/PROD/disk1/control02.ctl)
sga_max_size=500M
sga_target=500M
透過pfile檔案建立spfile
SYS@PROD>create spfile from pfile;
File created.
修改一些引數
SYS@PROD>show parameter undo;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string MANUAL
undo_retention integer 900
undo_tablespace string
SYS@PROD>
SYS@PROD>alter system set undo_management=auto scope=spfile;#將undo表空間設定為自動管理
System altered.
SYS@PROD>show parameter job;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
job_queue_processes integer 0
SYS@PROD>
SYS@PROD>alter system set job_queue_processes=30 scope=spfile;#開啟作業
System altered.
將資料庫重啟一下。
SYS@PROD>startup nomount
ORACLE instance started.
Total System Global Area 524288000 bytes
Fixed Size 1220384 bytes
Variable Size 146800864 bytes
Database Buffers 373293056 bytes
Redo Buffers 2973696 bytes
SYS@PROD>
檢查路徑引數
SYS@PROD>col name format a40
SYS@PROD>col value format a50
SYS@PROD>
SYS@PROD>select name,value from v$parameter where name like '%dest%';
NAME VALUE
---------------------------------------- --------------------------------------------------
。。。。。。
standby_archive_dest ?/dbs/arch
db_create_file_dest
db_create_online_log_dest_1
db_create_online_log_dest_2
db_create_online_log_dest_3
db_create_online_log_dest_4
db_create_online_log_dest_5
db_recovery_file_dest
db_recovery_file_dest_size 0
background_dump_dest /u01/app/oracle/admin/PROD/bdump
NAME VALUE
---------------------------------------- --------------------------------------------------
user_dump_dest /u01/app/oracle/admin/PROD/udump
core_dump_dest /u01/app/oracle/admin/PROD/cdump
audit_file_dest /u01/app/oracle/admin/PROD/adump
確認這些路徑已經建立
建立建庫指令碼
vi create_database.sql
CREATE DATABASE PROD
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/PROD/disk1/redo01.log') SIZE 100M,
GROUP 2 ('/u01/app/oracle/oradata/PROD/disk1/redo02.log') SIZE 100M,
GROUP 3 ('/u01/app/oracle/oradata/PROD/disk1/redo03.log') SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET AL16UTF16
DATAFILE '/u01/app/oracle/oradata/PROD/disk1/system01.dbf' SIZE 325M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE users
DATAFILE '/u01/app/oracle/oradata/PROD/disk1/users01.dbf' size 200M REUSE
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u01/app/oracle/oradata/PROD/disk1/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
開始執行
SYS@PROD>@create_database.sql
Database created.
開啟資料檔案的自動擴充套件。
SYS@PROD>alter database datafile 1 autoextend on;
Database altered.
SYS@PROD>alter database datafile 2 autoextend on;
Database altered.
SYS@PROD>alter database datafile 3 autoextend on;
Database altered.
SYS@PROD>alter database datafile 4 autoextend on;
Database altered.
執行指令碼
在sys使用者下執行
SYS@PROD>spool script.log
SYS@PROD>@?/rdbms/admin/catalog.sql
SYS@PROD>@?/rdbms/admin/catproc.sql
SYS@PROD>@?/rdbms/admin/catblock.sql
SYS@PROD>@?/rdbms/admin/catoctk.sql
SYS@PROD>@?/rdbms/admin/owminst.plb
在system使用者下執行
SYSTEM@PROD>@?/sqlplus/admin/help/hlpbld.sql
SYSTEM@PROD>@?/sqlplus/admin/help/helpus.sql
SYSTEM@PROD>@?/sqlplus/admin/pupbld.sql
下面是各個指令碼的解釋。
CATALOG.SQL
Creates the views of the data dictionary tables, the dynamic performance views, and public synonyms for many of the views. Grants PUBLIC access to the synonyms
CATPROC.SQL
Runs all scripts required for or used with PL/SQL.
catblock.sql
Creates views that can dynamically display lock dependency graphs
catoctk.sql
Creates the Oracle Cryptographic Toolkit package
owminst.plb
A Installing Workspace Manager with Custom Databases
http://docs.oracle.com/cd/B12037_01/appdev.101/b10824/long_inst.htm
pupbld.sql
help/hlpbld.sql
help/helpus.sql
sqlplus的幫助資訊
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29107230/viewspace-1064177/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 手工建庫
- 手工建庫與dbca建庫
- 【oracle手工建庫】Oracle
- oracle手工建庫Oracle
- oracle 10 手工建庫Oracle
- Oracle 9 手工建庫Oracle
- Oracle手工建庫指南Oracle
- OCM實驗-網路配置
- 手工建庫---控制檔案
- 手工建庫完成過程
- Oracle 9 手工建庫(轉)Oracle
- 【手工建庫】手工方式建立 ORACLE資料庫全程記錄Oracle資料庫
- oracle 11g手工建庫Oracle
- Oracle 10g手工建庫Oracle 10g
- oracle-手工建庫指令碼Oracle指令碼
- Oracle10g 手工建庫Oracle
- 使用手工方法Clone異名資料庫實驗資料庫
- win7 下手工建oracle庫Win7Oracle
- OCM實驗-測試環境的搭建
- oracle10g linux 手工建庫OracleLinux
- OCM實驗-grid control安裝
- 水煮oracle28----oracle手工建庫步驟Oracle
- 第一次手工建資料庫資料庫
- 【安裝配置】oracle 10g 手工建庫Oracle 10g
- windows 上的手工建庫過程 (原創)Windows
- OCM實驗-grid control agent安裝
- oracle實驗記錄 手工 duplicate database(1)OracleDatabase
- Oracle基礎結構之手工建庫相關Oracle
- OEL6下ORACLE 11g手工建庫Oracle
- oracle 11.2.0.4 靜默安裝加手工建庫(-)Oracle
- 不使用dbca進行手工建庫的過程
- OCM實驗-使用線上重定義方式遷移表
- OCM實驗-建立含特殊欄位型別的表型別
- [20171124]手工使用種子庫建庫.txt
- 【OCM】kingsql分享關於OCM PROFILE頁面個人照片的經驗SQL
- 【手工建庫】確保資料庫處於自動 UNDO管理模式資料庫模式
- OCM實驗-GC資源管理器資源消耗組演示GC
- 手工建立資料庫及刪除資料庫示例--附建庫時alert日誌資料庫