- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
In this example I'll describe steps for cloning orcl database to new database orcl2.
1. Create pfile from spfile from the database orcl:
2. copy created init file for the new orcl2 database:
3. edit pfile of the database orcl2:
4. Create directory structure:
5. Edit /etc/oratab:
6. setup new environment for the database orcl2
7. startup nomount database orcl2
8. copy password file from database orcl to orcl2 ($ORACLE_HOME/dbs)
9. update information in tnsnames.ora ($ORACLE_HOME/network/admin)
10. update information in listener.ora ($ORACLE_HOME/network/admin)
11. connect to the rman
12. run duplicate command:
SQL> create pfile from spfile; |
cp initorcl.ora initorcl2.ora |
- remove all hidden parameters
- change orcl to orcl2 except db_name
- add new line with: *.db_name='orcl'
*.db_unique_name='orcl2'
[oracle@localhost dbs]$ cat initorcl2.ora *.audit_file_dest='/u01/app/oracle/admin/orcl2/adump' *.audit_trail='db' *.compatible='12.1.0.2.0' *.control_files='/u01/app/oracle/oradata/orcl2/control01.ctl','/u01/app/oracle/oradata/orcl2/control02.ctl' *.db_block_size=8192 *.db_domain='' *.db_name='orcl' *.db_unique_name='orcl2' *.diagnostic_dest='/u01/app/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)' *.local_listener='LISTENER_ORCL' *.memory_target=1200m *.open_cursors=300 *.processes=300 *.remote_login_passwordfile='EXCLUSIVE' *.undo_tablespace='UNDOTBS1' |
[oracle@localhost dbs]$ mkdir -p /u01/app/oracle/admin/orcl2/adump [oracle@localhost dbs]$ mkdir /u01/app/oracle/oradata/orcl2 [oracle@localhost dbs]$ mkdir /u01/app/oracle/fast_recovery_area/orcl2 |
[oracle@localhost dbs]$ cat /etc/oratab orcl:/u01/app/oracle/product/12.1.0/dbhome_1:N orcl2:/u01/app/oracle/product/12.1.0/dbhome_1:N |
[oracle@localhost dbs]$ cat /etc/oratab [oracle@localhost dbs]$ . oraenv ORACLE_SID = [orcl] ? orcl2 The Oracle base remains unchanged with value /u01/app/oracle |
SQL> startup nomount ORACLE instance started. Total System Global Area 524288000 bytes Fixed Size 2926320 bytes Variable Size 444598544 bytes Database Buffers 71303168 bytes Redo Buffers 5459968 bytes |
[oracle@localhost dbs]$ ls -la orapworcl* -rw-r----- 1 oracle oinstall 7680 Oct 10 12:42 orapworcl [oracle@localhost dbs]$ cp orapworcl orapworcl2 |
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
ORCL2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl2)
)
)
|
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=orcl)
(ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME=orcl))
(SID_DESC=
(GLOBAL_DBNAME=orcl2)
(ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME=orcl2))
)
|
[oracle@localhost admin]$ rman target sys/oracle@orcl auxiliary sys/oracle@orcl2 Recovery Manager: Release 12.1.0.2.0 - Production on Tue Oct 10 15:47:43 2017 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL (DBID=1484792494) connected to auxiliary database: ORCL (not mounted) |
run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate channel prmy3 type disk;
allocate channel prmy4 type disk;
allocate auxiliary channel stby type disk;
duplicate target database to orcl2 from active database
SPFILE PARAMETER_VALUE_CONVERT '/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/orcl2'
set DB_FILE_NAME_CONVERT 'orcl','orcl2'
set log_file_name_convert '/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/orcl2'
set DB_UNIQUE_NAME 'orcl2'
set control_files='/u01/app/oracle/oradata/orcl2/control01.ctl',
'/u01/app/oracle/fast_recovery_area/orcl2/control02.ctl';
}
|
Comments
Post a Comment