Sei sulla pagina 1di 25

DB EXPERTS 9866465379

Creating Database manually under oracle RAC

To create database manually in RAC first we need to create single instance


Database from node1 and keep the database in a shared storage, then
Convert to rac and add other instances.
Login into node1 as oracle user and set environment as follows

[oracle@node1 ~]$ . oraenv


ORACLE_SID = [oracle] ? test1
ORACLE_HOME = [/home/oracle] ? /orasoft/10g

Create the directory structure to keep alert log file and trace files

[oracle@node1 ~]$ mkdir /orasoft/test


[oracle@node1 ~]$ mkdir /orasoft/test/adump
[oracle@node1 ~]$ mkdir /orasoft/test/bdump
[oracle@node1 ~]$ mkdir /orasoft/test/cdump
[oracle@node1 ~]$ mkdir /orasoft/test/udump
[oracle@node1 ~]$

Create pfile with the following parameters


ORACLE_SID is test1 and database name is test

[oracle@node1 ~]$ vi /orasoft/10g/dbs/inittest1.ora


[oracle@node1 ~]$ cat /orasoft/10g/dbs/inittest1.ora
db_cache_size=402653184
java_pool_size=4194304
large_pool_size=4194304
shared_pool_size=184549376
streams_pool_size=0
*.audit_file_dest='/orasoft/test/adump'
*.background_dump_dest='/orasoft/test/bdump'
*.compatible='10.2.0.1.0'
*.control_files='+DG1'
*.core_dump_dest='/orasoft/test/cdump'
*.db_block_size=8192
*.db_create_file_dest='+DG1'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='test'

1
DB EXPERTS 9866465379

*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=200278016
*.processes=150
*.remote_login_passwordfile='exclusive'
*.sga_target=600834048
*.undo_management='AUTO'
undo_tablespace='UNDOTBS1'
*.user_dump_dest='/orasoft/test/udump'
[oracle@node1 ~]$

Connect to oracle and startup the instance in nomount

[oracle@node1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Wed Apr 20 11:24:53 2011

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to an idle instance.

SQL> startup nomount;


ORACLE instance started.

Total System Global Area 603979776 bytes


Fixed Size 1268872 bytes
Variable Size 192938872 bytes
Database Buffers 402653184 bytes
Redo Buffers 7118848 bytes
SQL>

Create the database as follows

SQL> create database test


2 undo tablespace undotbs1
3 default temporary tablespace tmp1;

Database created.

Run the following scripts

2
DB EXPERTS 9866465379

SQL> @/orasoft/10g/rdbms/admin/catalog.sql;
SQL> @/orasoft/10g/rdbms/admin/catproc.sql;
SQL> @/orasoft/10g/rdbms/admin/catclust.sql;
SQL> conn system/manager
Connected.
SQL> @/orasoft/10g/sqlplus/admin/pupbld.sql;

SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
+DG1/test/controlfile/current.323.748956375

SQL> shutdown immediate;


Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release
10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
[oracle@node1 ~]$ cd /orasoft/10g/dbs/

Open the pfile and modify control_files parameter with above controlfile
Value

Create password file

[oracle@node1 dbs]$ orapwd file=orapwtest1 password=oracle


[oracle@node1 dbs]$

Open tnsnames.ora file and add the following alias for remote_listener
Parameter

[oracle@node1 dbs]$ vi /orasoft/10g/network/admin/tnsnames.ora

Add the following entry in both nodes

3
DB EXPERTS 9866465379

LISTENERS_TEST =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))
)

Open pfile and add remote_listener parameter


And also add remaining parameters for cluster database and for instance 2

[oracle@node1 dbs]$ cat inittest1.ora


db_cache_size=402653184
java_pool_size=4194304
large_pool_size=4194304
shared_pool_size=184549376
streams_pool_size=0
*.audit_file_dest='/orasoft/test/adump'
*.background_dump_dest='/orasoft/test/bdump'
*.compatible='10.2.0.1.0'
*.control_files='+DG1/test/controlfile/current.323.748956375'
*.core_dump_dest='/orasoft/test/cdump'
*.db_block_size=8192
*.db_create_file_dest='+DG1'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='test'
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=200278016
*.processes=150
*.remote_login_passwordfile='exclusive'
*.sga_target=600834048
*.undo_management='AUTO'
test1.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/orasoft/test/udump'
cluster_database=true
cluster_database_instances = 2
test2.undo_tablespace = 'UNDOTBS2'
test1.instance_number = 1
test2.instance_number = 2

4
DB EXPERTS 9866465379

test1.thread = 1
test2.thread = 2
remote_listener = 'LISTENERS_TEST'
[oracle@node1 dbs]$
Startup the database and create second undo tablespace , thread 2 for
Instance 2

[oracle@node1 ~]$ export ORACLE_SID=test1


[oracle@node1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Wed Apr 20 11:49:32 2011

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area 603979776 bytes


Fixed Size 1268872 bytes
Variable Size 192938872 bytes
Database Buffers 402653184 bytes
Redo Buffers 7118848 bytes
Database mounted.
Database opened.
SQL>

SQL> create undo tablespace undotbs2;

Tablespace created.

SQL> alter database add logfile thread 2;

Database altered.

SQL> alter database add logfile thread 2;

Database altered.

5
DB EXPERTS 9866465379

SQL>

SQL> alter database enable thread 2;

Database altered.

SQL>

After adding and enabling thread 2 shutdown the database.

SQL> shut immediate;


Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release
10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
[oracle@node1 ~]$

[oracle@node1 ~]$ crs_stat -t


Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2

Transfer pfile and password file to second node

[oracle@node1 ~]$ scp /orasoft/10g/dbs/inittest1.ora


oracle@node2:/orasoft/10g/dbs/inittest2.ora

6
DB EXPERTS 9866465379

inittest1.ora 100% 909 0.9KB/s 00:00


[oracle@node1 ~]$ scp /orasoft/10g/dbs/orapwtest1
oracle@node2:/orasoft/10g/dbs/orapwtest2
orapwtest1 100% 1536 1.5KB/s 00:00
[oracle@node1 ~]$

Login into second node as oracle user and create the directory structure
For alert log and trace files. Edit tnsnames.ora file and keep the alias for
Remote_listener parameter.

[oracle@node1 ~]$ ssh node2


Last login: Wed Apr 20 14:30:19 2011 from node1
[oracle@node2 ~]$ mkdir /orasoft/test
[oracle@node2 ~]$ mkdir /orasoft/test/adump
[oracle@node2 ~]$ mkdir /orasoft/test/bdump
[oracle@node2 ~]$ mkdir /orasoft/test/cdump
[oracle@node2 ~]$ mkdir /orasoft/test/udump
[oracle@node2 ~]$

Using srvctl command add database and instances to OCR

[oracle@node1 ~]$ srvctl add database -d test -o /orasoft/10g


[oracle@node1 ~]$ srvctl add instance -d test -i test1 -n node1
[oracle@node1 ~]$ srvctl add instance -d test -i test2 -n node2
[oracle@node1 ~]$

[oracle@node1 ~]$ crs_stat -t


Name Type Target State Host
------------------------------------------------------------

ora....SM1.asm application ONLINE ONLINE node1


ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2

7
DB EXPERTS 9866465379

ora.test.db application OFFLINE OFFLINE


ora....t1.inst application OFFLINE OFFLINE
ora....t2.inst application OFFLINE OFFLINE
[oracle@node1 ~]$

Now start the database

[oracle@node1 ~]$ srvctl start database -d test

[oracle@node1 ~]$ crs_stat -t


Name Type Target State Host
------------------------------------------------------------
ora.dev.db application OFFLINE OFFLINE
ora....v1.inst application OFFLINE OFFLINE
ora....v2.inst application OFFLINE OFFLINE
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2
ora.test.db application ONLINE ONLINE node2
ora....t1.inst application ONLINE ONLINE node1
ora....t2.inst application ONLINE ONLINE node2
[oracle@node1 ~]$

8
DB EXPERTS 9866465379

Configuring Archivelog under RAC

We can configure archive log from any one node. Let us say we are at first
node

[oracle@srv1 ~]$ crs_stat -t


Name Type Target State Host
------------------------------------------------------------
ora.prod.db application ONLINE ONLINE srv1
ora....d1.inst application ONLINE ONLINE srv1
ora....d2.inst application ONLINE ONLINE srv2
ora....d3.inst application ONLINE ONLINE srv3
ora....SM1.asm application ONLINE ONLINE srv1
ora....V1.lsnr application ONLINE ONLINE srv1
ora.srv1.gsd application ONLINE ONLINE srv1
ora.srv1.ons application ONLINE ONLINE srv1
ora.srv1.vip application ONLINE ONLINE srv1
ora....SM2.asm application ONLINE ONLINE srv2
ora....V2.lsnr application ONLINE ONLINE srv2
ora.srv2.gsd application ONLINE ONLINE srv2
ora.srv2.ons application ONLINE ONLINE srv2
ora.srv2.vip application ONLINE ONLINE srv2
ora....SM3.asm application ONLINE ONLINE srv3
ora....V3.lsnr application ONLINE ONLINE srv3
ora.srv3.gsd application ONLINE ONLINE srv3
ora.srv3.ons application ONLINE ONLINE srv3
ora.srv3.vip application ONLINE ONLINE srv3

[oracle@srv1 ~]$ export ORACLE_SID=prod1


[oracle@srv1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Fri May 13 08:14:32 2011

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

9
DB EXPERTS 9866465379

With the Partitioning, Real Application Clusters, OLAP and Data Mining
options

SQL> archive log list;


Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /orasoft/10g/dbs/arch
Oldest online log sequence 8
Current log sequence 9
SQL> cl scr;

Set the log_archive_dest_1 parameter to a shared location. In our case disk


group. Then make cluster_database parameter as false and stop the database.

[oracle@srv1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Fri May 13 08:21:07 2011

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, Real Application Clusters, OLAP and Data Mining
options

SQL> show parameter spfile;

NAME TYPE VALUE


------------------------------------ ----------- ------------------------------
spfile string +GRP1/prod/spfileprod.ora
SQL> cl scr;
SQL> alter system set
2 cluster_database=false
3 scope=spfile;

System altered.

SQL> alter system set


2 log_archive_dest_1='location=+GRP1'

10
DB EXPERTS 9866465379

3 scope=spfile;

System altered.

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release
10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining
options

[oracle@srv1 ~]$ srvctl stop database -d prod

Start any one instance as follows and change the archive log
[oracle@srv1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Fri May 13 08:23:05 2011

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup mount;


ORACLE instance started.

Total System Global Area 650117120 bytes


Fixed Size 1221060 bytes
Variable Size 176164412 bytes
Database Buffers 465567744 bytes
Redo Buffers 7163904 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list;


Database log mode Archive Mode

11
DB EXPERTS 9866465379

Automatic archival Enabled


Archive destination +GRP1
Oldest online log sequence 8
Next log sequence to archive 9
Current log sequence 9

Again make cluster_database parameter as true and restart all instances

SQL> alter system set


2 cluster_database=true
3 scope=spfile;

System altered.

SQL> shut immediate;


Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release
10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining
options

[oracle@srv1 ~]$ srvctl start database -d prod


[oracle@srv1 ~]$

Performing hot Backups using Rman under RAC

Create a folder to keep rman backups

[oracle@srv1 ~]$ mkdir /orasoft/backup


[oracle@srv1 ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Fri May 13 08:26:23


2011

Copyright (c) 1982, 2005, Oracle. All rights reserved.

12
DB EXPERTS 9866465379

connected to target database: PROD (DBID=162770196)

RMAN> show all;

using target database control file instead of recovery catalog


RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE
TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE
TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK
TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE
DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO
'/orasoft/10g/dbs/snapcf_prod1.f'; # default

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;

new RMAN configuration parameters:


CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

RMAN> configure channel device type disk format


2> '/orasoft/backup/%U';

new RMAN configuration parameters:


CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT
'/orasoft/backup/%U';
new RMAN configuration parameters are successfully stored

13
DB EXPERTS 9866465379

RMAN> show all


2> ;

RMAN configuration parameters are:


CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE
TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE
TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK
TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE
DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT
'/orasoft/backup/%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO
'/orasoft/10g/dbs/snapcf_prod1.f'; # default

RMAN> backup database plus archivelog;

Starting backup at 13-MAY-11


current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=17 instance=prod1 devtype=DISK
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=9 recid=2 stamp=751019370
input archive log thread=2 sequence=4 recid=1 stamp=751019383
input archive log thread=3 sequence=4 recid=3 stamp=751019373
channel ORA_DISK_1: starting piece 1 at 13-MAY-11
channel ORA_DISK_1: finished piece 1 at 13-MAY-11
piece handle=/orasoft/backup/01mc79bi_1_1 tag=TAG20110513T082937
comment=NONE

14
DB EXPERTS 9866465379

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02


Finished backup at 13-MAY-11

Starting backup at 13-MAY-11


using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001
name=+GRP1/prod/datafile/system.259.750931873
input datafile fno=00002 name=+GRP1/prod/datafile/undo1.260.750931879
input datafile fno=00003 name=+GRP1/prod/datafile/sysaux.261.750931879
input datafile fno=00004 name=+GRP1/prod/datafile/undo2.263.750932771
input datafile fno=00005 name=+GRP1/prod/datafile/undo3.264.750932823
channel ORA_DISK_1: starting piece 1 at 13-MAY-11
channel ORA_DISK_1: finished piece 1 at 13-MAY-11
piece handle=/orasoft/backup/02mc79bl_1_1 tag=TAG20110513T082941
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 13-MAY-11

Starting backup at 13-MAY-11


current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=10 recid=5 stamp=751019397
input archive log thread=2 sequence=5 recid=4 stamp=751019410
input archive log thread=3 sequence=5 recid=6 stamp=751019400
channel ORA_DISK_1: starting piece 1 at 13-MAY-11
channel ORA_DISK_1: finished piece 1 at 13-MAY-11
piece handle=/orasoft/backup/03mc79c8_1_1 tag=TAG20110513T083000
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 13-MAY-11

Starting Control File and SPFILE Autobackup at 13-MAY-11


piece handle=/orasoft/10g/dbs/c-162770196-20110513-00 comment=NONE
Finished Control File and SPFILE Autobackup at 13-MAY-11

RMAN> exit

15
DB EXPERTS 9866465379

Recovery Manager complete.


[oracle@srv1 ~]$ clear
[oracle@srv1 ~]$ cd /orasoft/backup/
[oracle@srv1 backup]$ ls
01mc79bi_1_1 02mc79bl_1_1 03mc79c8_1_1

Cloning RAC database as single instance database using rman hot


backups

Let us say we have backups on node1 in the following directory.


/orasoft/backup
Create the same directory on machine which is having single instance
environment.
Copy all the backups from node1 to single instance environement machine.
[oracle@srv5 ~]$ mkdir /orasoft/backup (single instance machine where
cloning need to be done)

[oracle@srv1 backup]$ scp * oracle@192.168.2.213:/orasoft/backup


The authenticity of host '192.168.2.213 (192.168.2.213)' can't be established.
RSA key fingerprint is a1:33:5e:d7:c5:8e:bd:c9:54:ba:5a:cc:7c:5e:a9:25.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.2.213' (RSA) to the list of known
hosts.
oracle@192.168.2.213's password:
01mc79bi_1_1 100% 2352KB 2.3MB/s
00:00
02mc79bl_1_1 100% 272MB 11.3MB/s
00:24
03mc79c8_1_1 100% 18KB 17.5KB/s
00:00

Create a pfile and transfer pfile also from node1 to single instance machine.

[oracle@srv5 ~]$ mkdir /orasoft/rclone (single instance machine)

[oracle@srv1 backup]$ cd /orasoft/10g/ (rac node1)


[oracle@srv1 10g]$ scp initprod1.ora oracle@192.168.2.213:/orasoft/rclone
oracle@192.168.2.213's password:

16
DB EXPERTS 9866465379

initprod1.ora 100% 8934 8.7KB/s 00:00


[oracle@srv1 10g]$

Now login into single instance machine as oracle user

login as: oracle


oracle@192.168.2.213's password:
Last login: Fri May 13 01:59:32 2011 from 192.168.2.3
[oracle@srv5 ~]$ clear

Set the following environment let us say ORACLE_SID is rclone


And create the directory structure required

[oracle@srv5 ~]$ export ORACLE_SID=rclone


[oracle@srv5 ~]$ mkdir /orasoft/rclone/adump
[oracle@srv5 ~]$ mkdir /orasoft/rclone/bdump
[oracle@srv5 ~]$ mkdir /orasoft/rclone/cdump
[oracle@srv5 ~]$ mkdir /orasoft/rclone/udump
[oracle@srv5 ~]$ cd /orasoft/rclone/
[oracle@srv5 rclone]$ ls
adump bdump cdump initprod1.ora udump

Now open tnsnames.ora file and add an alias to connect to rac database
instance 1
[oracle@srv5 rclone]$ vi /orasoft/10g/network/admin/tnsnames.ora
[oracle@srv5 rclone]$ cat /orasoft/10g/network/admin/tnsnames.ora
PROD1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = srv1-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prod)
(INSTANCE_NAME = prod1)
)
)

As root user add rac node1 vip to /etc/hosts file


[oracle@srv5 rclone]$ su -
Password:
[root@srv5 ~]# vi /etc/hosts

17
DB EXPERTS 9866465379

[root@srv5 ~]# exit


logout

Open pfile and make changes as per the requirement, then copy the pfile to
default location and rename it.

[oracle@srv5 rclone]$ vi initprod1.ora


[oracle@srv5 rclone]$ cp initprod1.ora /orasoft/10g/dbs/initrclone.ora
[oracle@srv5 rclone]$ . oraenv
ORACLE_SID = [rclone] ?
ORACLE_HOME = [/home/oracle] ? /orasoft/10g
[oracle@srv5 rclone]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Fri May 13 16:40:52 2011

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup nomount;


ORACLE instance started.

Total System Global Area 650117120 bytes


Fixed Size 1221060 bytes
Variable Size 176164412 bytes
Database Buffers 465567744 bytes
Redo Buffers 7163904 bytes
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release
10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@srv5 rclone]$ clear

Now connect to rman as follows and clone the database using duplicate
command

[oracle@srv5 rclone]$ rman target sys/oracle@prod1 auxiliary /

Recovery Manager: Release 10.2.0.1.0 - Production on Fri May 13 16:43:08


2011

18
DB EXPERTS 9866465379

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: PROD (DBID=162770196)


connected to auxiliary database: RCLONE (not mounted)

RMAN> duplicate target database to 'rclone';

Starting Duplicate Db at 13-MAY-11


using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=47 devtype=DISK

contents of Memory Script:


{
set until scn 321703;
set newname for datafile 1 to
"/orasoft/rclone/system.259.750931873";
set newname for datafile 2 to
"/orasoft/rclone/undo1.260.750931879";
set newname for datafile 3 to
"/orasoft/rclone/sysaux.261.750931879";
set newname for datafile 4 to
"/orasoft/rclone/undo2.263.750932771";
set newname for datafile 5 to
"/orasoft/rclone/undo3.264.750932823";
restore
check readonly
clone database
;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

19
DB EXPERTS 9866465379

executing command: SET NEWNAME


"/orasoft/rclone/system.259.750931873";
set newname for datafile 2 to
"/orasoft/rclone/undo1.260.750931879";
set newname for datafile 3 to
"/orasoft/rclone/sysaux.261.750931879";
set newname for datafile 4 to
"/orasoft/rclone/undo2.263.750932771";
set newname for datafile 5 to
"/orasoft/rclone/undo3.264.750932823";
restore
check readonly
clone database
;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME


executing command: SET NEWNAME

Starting restore at 13-MAY-11


using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backupset restore


channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup
set
restoring datafile 00001 to /orasoft/rclone/system.259.750931873
restoring datafile 00002 to /orasoft/rclone/undo1.260.750931879
restoring datafile 00003 to /orasoft/rclone/sysaux.261.750931879
restoring datafile 00004 to /orasoft/rclone/undo2.263.750932771
restoring datafile 00005 to /orasoft/rclone/undo3.264.750932823

20
DB EXPERTS 9866465379

channel ORA_AUX_DISK_1: reading from backup piece


/orasoft/backup/02mc79bl_1_1
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/orasoft/backup/02mc79bl_1_1 tag=TAG20110513T082941
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 13-MAY-11
sql statement: CREATE CONTROLFILE REUSE SET DATABASE
"RCLONE" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 30
MAXINSTANCES 63
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/orasoft/rclone/group_1.257.750931869' ) SIZE 100 M
REUSE,
GROUP 2 ( '/orasoft/rclone/group_2.258.750931871' ) SIZE 100 M
REUSE
DATAFILE
'/orasoft/rclone/system.259.750931873'
CHARACTER SET US7ASCII

contents of Memory Script:


{
switch clone datafile all;
}
executing Memory Script

released channel: ORA_AUX_DISK_1


datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=751049090
filename=/orasoft/rclone/undo1.260.750931879
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=751049090
filename=/orasoft/rclone/sysaux.261.750931879
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=751049090
filename=/orasoft/rclone/undo2.263.750932771
datafile 5 switched to datafile copy

21
DB EXPERTS 9866465379

input datafile copy recid=4 stamp=751049090


filename=/orasoft/rclone/undo3.264.750932823

contents of Memory Script:


{
set until scn 321703;
recover
clone database
delete archivelog
;
}
executing Memory Script

executing command: SET until clause

Starting recover at 13-MAY-11


allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=47 devtype=DISK

starting media recovery


channel ORA_AUX_DISK_1: starting archive log restore to default
destination
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=10
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=2 sequence=5
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=3 sequence=5
channel ORA_AUX_DISK_1: reading from backup piece
/orasoft/backup/03mc79c8_1_1
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/orasoft/backup/03mc79c8_1_1 tag=TAG20110513T083000
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archive log filename=/orasoft/10g/dbs/arch1_10_750931860.dbf thread=1
sequence=10
archive log filename=/orasoft/10g/dbs/arch2_5_750931860.dbf thread=2
sequence=5
archive log filename=/orasoft/10g/dbs/arch3_5_750931860.dbf thread=3
sequence=5
channel clone_default: deleting archive log(s)

22
DB EXPERTS 9866465379

archive log filename=/orasoft/10g/dbs/arch1_10_750931860.dbf recid=1


stamp=751049091
channel clone_default: deleting archive log(s)
archive log filename=/orasoft/10g/dbs/arch2_5_750931860.dbf recid=2
stamp=751049091
channel clone_default: deleting archive log(s)
archive log filename=/orasoft/10g/dbs/arch3_5_750931860.dbf recid=3
stamp=751049091
media recovery complete, elapsed time: 00:00:02
Finished recover at 13-MAY-11

contents of Memory Script:


{
shutdown clone;
startup clone nomount ;
}
executing Memory Script
database dismounted
Oracle instance shut down

connected to auxiliary database (not started)


Oracle instance started

Total System Global Area 650117120 bytes

Fixed Size 1221060 bytes


Variable Size 176164412 bytes
Database Buffers 465567744 bytes
Redo Buffers 7163904 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE
"RCLONE" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 30
MAXINSTANCES 63
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/orasoft/rclone/group_1.257.750931869' ) SIZE 100 M
REUSE,

23
DB EXPERTS 9866465379

GROUP 2 ( '/orasoft/rclone/group_2.258.750931871' ) SIZE 100 M


REUSE
DATAFILE
'/orasoft/rclone/system.259.750931873'
CHARACTER SET US7ASCII

contents of Memory Script:


{
set newname for tempfile 1 to
"/orasoft/rclone/tmp1.262.750931881";
switch clone tempfile all;
catalog clone datafilecopy "/orasoft/rclone/undo1.260.750931879";
catalog clone datafilecopy "/orasoft/rclone/sysaux.261.750931879";
catalog clone datafilecopy "/orasoft/rclone/undo2.263.750932771";
catalog clone datafilecopy "/orasoft/rclone/undo3.264.750932823";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed temporary file 1 to /orasoft/rclone/tmp1.262.750931881 in control
file
cataloged datafile copy
datafile copy filename=/orasoft/rclone/undo1.260.750931879 recid=1
stamp=751049099
cataloged datafile copy
datafile copy filename=/orasoft/rclone/sysaux.261.750931879 recid=2
stamp=751049100

cataloged datafile copy


datafile copy filename=/orasoft/rclone/undo2.263.750932771 recid=3
stamp=751049100

cataloged datafile copy


datafile copy filename=/orasoft/rclone/undo3.264.750932823 recid=4
stamp=751049100

datafile 2 switched to datafile copy


input datafile copy recid=1 stamp=751049099
filename=/orasoft/rclone/undo1.260.750931879
datafile 3 switched to datafile copy

24
DB EXPERTS 9866465379

input datafile copy recid=2 stamp=751049100


filename=/orasoft/rclone/sysaux.261.750931879
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=751049100
filename=/orasoft/rclone/undo2.263.750932771
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=751049100
filename=/orasoft/rclone/undo3.264.750932823

contents of Memory Script:


{
Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 13-MAY-11

RMAN> exit

Recovery Manager complete.


[oracle@srv5 rclone]$ cd
[oracle@srv5 ~]$ clear
[oracle@srv5 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Fri May 13 16:45:28 2011


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 name,open_mode from v$database;

NAME OPEN_MODE
--------- ----------
RCLONE READ WRITE

SQL>

25

Potrebbero piacerti anche