透過Oracle的duplicate database to 【newsid】實現資料庫克隆;
環境:
Oracle10.2 RAC 到10.2單機環境執行;
[@more@]1.準備好相應的目錄結構
$cd /home/oracle/admin
$mkdir test
$cd test
$mkdir adump bdump cdump dpdump pfile udump
2.使用initoraT.ora建立引數檔案inittest.ora
$cd dbs
$cp initoraT.ora inittest.ora
修改inittest2.ora
test.__db_cache_size=8388608
test.__java_pool_size=4194304
test.__large_pool_size=4194304
test.__shared_pool_size=67108864
test.__streams_pool_size=4194304
*.audit_file_dest='/home/oracle/admin/test/adump'
*.background_dump_dest='/home/oracle/admin/test/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/home/oracle/oradata/test/control01.dbf','/home/oracle/oradata/test/control02.dbf'
*.core_dump_dest='/home/oracle/admin/test/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='test'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)'
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=167772160
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/home/oracle/admin/test/udump'
*.DB_FILE_NAME_CONVERT=('/home/oracle/oradata/oraT','/home/oracle/oradata/test')
*.LOG_FILE_NAME_CONVERT=('/home/oracle/oradata/oraT','/home/oracle/oradata/test')
3.建立密碼檔案
$orapwd file=orapwtest password=oracle entries=10
4.配置好監聽和tnsnames
5.使用rman備份原庫
先做一次包括archivelog的全備份
run {
allocate channel t1 type disk;
backup current controlfile;
backup full database;
backup archivelog all;
release channel t1;
}
6. 啟動test到nomount狀態;
SQL>startup nomount
7.開始duplicate target database to "test"
先set ORACLE_SID=test /*cloneSID*/
獲得原資料檔案的number方法:
SQL>select 'set new name for datafile '||FILE#||' to '||'"'||trim(name)||'"' FROM v$datafile;
rman>connect target
rman>connect auxiliary sys/oracle
run{
allocate auxiliary channel t1 type disk;
set newname for datafile 1 to '/home/oracle/oradata/test/system01.dbf';
set newname for datafile 2 to '/home/oracle/oradata/test/undotbs1.bdf';
set newname for datafile 3 to '/home/oracle/oradata/test/sysaux01.dbf';
set newname for datafile 4 to '/home/oracle/oradata/test/users01.bdf';
set newname for datafile 5 to '/home/oracle/oradata/test/t1.dbf';
DUPLICATE TARGET DATABASE TO "test"
LOGFILE
GROUP 1 ('/home/oracle/oradata/test/redo01.log') SIZE 5M,
GROUP 2 ('/home/oracle/oradata/test/redo02.log') SIZE 5M,
GROUP 3 ('/home/oracle/oradata/test/redo03.log') SIZE 5M;
}
8.測試,並建立spfile;
刪除pfile檔案中的引數:
*.DB_FILE_NAME_CONVERT=('/home/oracle/oradata/oraT','/home/oracle/oradata/test')
*.LOG_FILE_NAME_CONVERT=('/home/oracle/oradata/oraT','/home/oracle/oradata/test')
SQL> startup
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 62916852 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
SQL> show parameter pfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /home/oracle/product/10.2/db/d
bs/spfiletest.ora
SQL> show parameter instance;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
active_instance_count integer
cluster_database_instances integer 1
instance_groups string
instance_name string test
instance_number integer 0
instance_type string RDBMS
open_links_per_instance integer 4
parallel_instance_group string
parallel_server_instances integer 1
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string test
SQL> show parameter db_do
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_domain string
SQL> show parameter service_names
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string test
[oracle@OTest dbs]$ sqlplus
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jun 25 01:05:49 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
test OPEN
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/74346/viewspace-916127/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用duplicate克隆資料庫資料庫
- 克隆OS、ORACLE軟體並duplicate的實戰Oracle
- Duplicate 複製資料庫實驗過程資料庫
- oracle 11g duplicate from active database 複製資料庫(四)OracleDatabase資料庫
- oracle 11g duplicate from active database 複製資料庫(三)OracleDatabase資料庫
- oracle 11g duplicate from active database 複製資料庫(二)OracleDatabase資料庫
- oracle 11g duplicate from active database 複製資料庫(一)OracleDatabase資料庫
- RMAN duplicate from active database 複製資料庫Database資料庫
- 通過rman duplicate database!Database
- Oracle 11gR2 使用 RMAN duplicate from active database 複製資料庫OracleDatabase資料庫
- oracle 11g duplicate database基於備份複製資料庫(六)OracleDatabase資料庫
- oracle 11g duplicate database基於備份複製資料庫(五)OracleDatabase資料庫
- oracle 11g duplicate database基於備份複製資料庫(四)OracleDatabase資料庫
- oracle 11g duplicate database基於備份複製資料庫(三)OracleDatabase資料庫
- oracle 11g duplicate database基於備份複製資料庫(二)OracleDatabase資料庫
- oracle 11g duplicate database基於備份複製資料庫(一)OracleDatabase資料庫
- 靜默建立oracle資料庫及克隆資料庫Oracle資料庫
- ORACLE DUPLICATE建立物理standby資料庫Oracle資料庫
- Oracle 之 Duplicate 複製資料庫Oracle資料庫
- Oracle 如何快速的 duplicate 一個資料庫Oracle資料庫
- oracle 觸發器實現禁止在資料庫中建立dblink ---透過觸發器實現Oracle觸發器資料庫
- oracle實驗記錄 手工 duplicate database(1)OracleDatabase
- oracle實驗記錄Rman duplicate database(1)OracleDatabase
- oracle實驗記錄Rman duplicate database 2OracleDatabase
- 透過API介面實現資料探勘?API
- 使用Oracle VPD(Virtual Private Database)實現資料庫層面資料許可權OracleDatabase資料庫
- oracle透過expdp的remap_data實現簡單的資料脫敏OracleREM
- Oracle 11G Duplicate DatabaseOracleDatabase
- oracle之 oracle database vault(資料庫保險庫)OracleDatabase資料庫
- oracle實驗記錄 (手動 duplicate database(3))OracleDatabase
- 9i 克隆+data guard 實現資料庫搬遷資料庫
- 11g RMAN新特性active database duplicate 資料庫異構Database資料庫
- 透過等待看資料庫資料庫
- 資料庫所有檔案丟失後透過RMAN實現恢復資料庫
- duplicate databaseDatabase
- 使用 RMAN DUPLICATE...FROM ACTIVE DATABASE 建立物理備用資料庫的分步指南Database資料庫
- flink 透過繼承RichSinkFunction實現自定義sink,將資料錄入資料庫繼承Function資料庫
- Redis 資料庫、鍵過期的實現Redis資料庫