Search This Blog

Wednesday, August 11, 2021

What is RAC?

 What is RAC?

RAC stands for Real Application cluster. It is a clustering solution from Oracle Corporation that ensures high availability of databases by providing instance failover, media failover features.

Mention the Oracle RAC software components:-

Oracle RAC is composed of two or more database instances. They are composed of Memory structures and background processes same as the single instance database.Oracle RAC instances use two processes GES(Global Enqueue Service), GCS(Global Cache Service) that enable cache fusion.Oracle RAC instances are composed of following background processes:

ACMS—Atomic Controlfile to Memory Service (ACMS)

GTX0-j—Global Transaction Process

LMON—Global Enqueue Service Monitor

LMD—Global Enqueue Service Daemon

LMS—Global Cache Service Process

LCK0—Instance Enqueue Process

RMSn—Oracle RAC Management Processes (RMSn)

RSMN—Remote Slave Monitor 



What is GRD?

GRD stands for Global Resource Directory. The GES and GCS maintains records of the statuses of each datafile and each cahed block using global resource directory.This process is referred to as cache fusion and helps in data integrity.

Give Details on Cache Fusion:-

Oracle RAC is composed of two or more instances. When a block of data is read from datafile by an instance within the cluster and another instance is in need of the same block,it is easy to get the block image from the insatnce which has the block in its SGA rather than reading from the disk. To enable inter instance communication Oracle RAC makes use of interconnects. The Global Enqueue Service(GES) monitors and Instance enqueue process manages the cahce fusion. Give Details on ACMS:-

ACMS stands for Atomic Controlfile Memory Service.In an Oracle RAC environment ACMS is an agent that ensures a distributed SGA memory update(ie)SGA updates are globally committed on success or globally aborted in event of a failure.

Give details on GTX0-j :-

The process provides transparent support for XA global transactions in a RAC environment.The database autotunes the number of these processes based on the workload of XA global transactions.

Give details on LMON:-

This process monitors global enques and resources across the cluster and performs global enqueue recovery operations.This is called as Global Enqueue Service Monitor.

Give details on LMD:-

This process is called as global enqueue service daemon. This process manages incoming remote resource requests within each instance.

Give details on LMS:-

This process is called as Global Cache service process.This process maintains statuses of datafiles and each cahed block by recording information in a Global Resource Dectory(GRD).This process also controls the flow of messages to remote instances and manages global data block access and transmits block images between the buffer caches of different instances.This processing is a part of cache fusion feature.

Give details on LCK0:-

This process is called as Instance enqueue process.This process manages non-cache fusion resource requests such as libry and row cache requests.

Give details on RMSn:-

This process is called as Oracle RAC management process.These pocesses perform managability tasks for Oracle RAC.Tasks include creation of resources related Oracle RAC when new instances are added to the cluster.

Give details on RSMN:-

This process is called as Remote Slave Monitor.This process manages background slave process creation andd communication on remote instances. This is a background slave process.This process performs tasks on behalf of a co-ordinating process running in another instance.

What components in RAC must reside in shared storage?

All datafiles, controlfiles, SPFIles, redo log files must reside on cluster-aware shred storage.

What is the significance of using cluster-aware shared storage in an Oracle RAC environment?

All instances of an Oracle RAC can access all the datafiles,control files, SPFILE's, redolog files when these files are hosted out of cluster-aware shared storage which are group of shared disks.

Give few examples for solutions that support cluster storage:-

ASM(automatic storage management),raw disk devices,network file system(NFS), OCFS2 and OCFS(Oracle Cluster Fie systems).

For more details visit


What is an interconnect network?

an interconnect network is a private network that connects all of the servers in a cluster. The interconnect network uses a switch/multiple switches that only the nodes in the cluster can access.

How can we configure the cluster interconnect?

Configure User Datagram Protocol(UDP) on Gigabit ethernet for cluster interconnect.On unia and linux systems we use UDP and RDS(Reliable data socket) protocols to be used by Oracle Clusterware.Windows clusters use the TCP protocol.

Can we use crossover cables with Oracle Clusterware interconnects?

No, crossover cables are not supported with Oracle Clusterware intercnects.

What is the use of cluster interconnect?

Cluster interconnect is used by the Cache fusion for inter instance communication.

How do users connect to database in an Oracle RAC environment?

Users can access a RAC database using a client/server configuration or through one or more middle tiers ,with or without connection pooling.Users can use oracle services feature to connect to database.

What is the use of a service in Oracle RAC environemnt?

Applications should use the services feature to connect to the Oracle database.Services enable us to define rules and characteristics to control how users and applications connect to database instances.

What are the characteriscs controlled by Oracle services feature?

The charateristics include a unique name, workload balancing and failover options,and high availability characteristics.

Which enable the load balancing of applications in RAC?

Oracle Net Services enable the load balancing of application connections across all of the instances in an Oracle RAC database.

What is a virtual IP address or VIP?

A virtl IP address or VIP is an alternate IP address that the client connectins use instead of the standard public IP address. To configureVIP address, we need to reserve a spare IP address for each node, and the IP addresses must use the same subnet as the public network.

What is the use of VIP?

If a node fails, then the node's VIP address fails over to another node on which the VIP address can accept TCP connections but it cannot accept Oracle connections.

Give situations under which VIP address failover happens:-

VIP addresses failover happens when the node on which the VIP address runs fails, all interfaces for the VIP address fails, all interfaces for the VIP address are disconnected from the network.

What is the significance of VIP address failover?

When a VIP address failover happens, Clients that attempt to connect to the VIP address receive a rapid connection refused error .They don't have to wait for TCP connection timeout messages.

What are the administrative tools used for Oracle RAC environments?

Oracle RAC cluster can be administered as a single image using OEM(Enterprise Manager),SQL*PLUS,Servercontrol(SRVCTL),clusterverificationutility(cvu),DBCA,NETCA


For more details visit>>


How do we verify that RAC instances are running?

Issue the following query from any one node connecting through SQL*PLUS.

$connect sys/sys as sysdba

SQL>select * from V$ACTIVE_INSTANCES;

The query gives the instance number under INST_NUMBER column,host_:instancename under INST_NAME column.

What is FAN?

Fast application Notification as it abbreviates to FAN relates to the events related to instances,services and nodes.This is a notification mechanism that Oracle RAc uses to notify other processes about the configuration and service level information that includes service status changes such as,UP or DOWN events.Applications can respond to FAN events and take immediate action.

Where can we apply FAN UP and DOWN events?

FAN UP and FAN DOWN events can be applied to instances,services and nodes.

State the use of FAN events in case of a cluster configuration change?

During times of cluster configuration changes,Oracle RAC high availability framework publishes a FAN event immediately when a state change occurs in the cluster.So applications can receive FAN events and react immediately.This prevents applications from polling database and detecting a problem after such a state change.

Why should we have seperate homes for ASm instance?

It is a good practice to have ASM home seperate from the database hom(ORACLE_HOME).This helps in upgrading and patching ASM and the Oracle database software independent of each other.Also,we can deinstall the Oracle database software independent of the ASM instance.

What is the advantage of using ASM?

Having ASM is the Oracle recommended storage option for RAC databases as the ASM maximizes performance by managing the storage configuration across the disks.ASM does this by distributing the database file across all of the available storage within our cluster database environment.

What is rolling upgrade?

It is a new ASM feature from Database 11g.ASM instances in Oracle database 11g release(from 11.1) can be upgraded or patched using rolling upgrade feature. This enables us to patch or upgrade ASM nodes in a clustered environment without affecting database availability.During a rolling upgrade we can maintain a functional cluster while one or more of the nodes in the cluster are running in different software versions.

Can rolling upgrade be used to upgrade from 10g to 11g database?

No,it can be used only for Oracle database 11g releases(from 11.1).

State the initialization parameters that must have same value for every instance in an Oracle RAC database:-

Some initialization parameters are critical at the database creation time and must have same values.Their value must be specified in SPFILE or PFILE for every instance.The list of parameters that must be identical on every instance are given below:

ACTIVE_INSTANCE_COUNT

ARCHIVE_LAG_TARGET

COMPATIBLE

CLUSTER_DATABASE

CLUSTER_DATABASE_INSTANCE

CONTROL_FILES

DB_BLOCK_SIZE

DB_DOMAIN

DB_FILES

DB_NAME

DB_RECOVERY_FILE_DEST

DB_RECOVERY_FILE_DEST_SIZE

DB_UNIQUE_NAME

INSTANCE_TYPE (RDBMS or ASM)

PARALLEL_MAX_SERVERS

REMOTE_LOGIN_PASSWORD_FILE

UNDO_MANAGEMENT

Can the DML_LOCKS and RESULT_CACHE_MAX_SIZE be identical on all instances?

These parameters can be identical on all instances only if these parameter values are set to zero.

What two parameters must be set at the time of starting up an ASM instance in a RAC environment?The parameters CLUSTER_DATABASE and INSTANCE_TYPE must be set.

Mention the components of Oracle clusterware:-

Oracle clusterware is made up of components like voting disk and Oracle Cluster Registry(OCR). What is a CRS resource?

Oracle clusterware is used to manage high-availability operations in a cluster.Anything that Oracle Clusterware manages is known as a CRS resource.Some examples of CRS resources are database,an instance,a service,a listener,a VIP address,an application process etc.

What is the use of OCR?

Oracle clusterware manages CRS resources based on the configuration information of CRS resources stored in OCR(Oracle Cluster Registry).

How does a Oracle Clusterware manage CRS resources?

Oracle clusterware manages CRS resources based on the configuration information of CRS resources stored in OCR(Oracle Cluster Registry).

Name some Oracle clusterware tools and their uses?

OIFCFG - allocating and deallocating network interfaces

OCRCONFIG - Command-line tool for managing Oracle Cluster Registry

OCRDUMP - Identify the interconnect being used

CVU - Cluster verification utility to get status of CRS resources

What are the modes of deleting instances from ORacle Real Application cluster Databases?

We can delete instances using silent mode or interactive mode using DBCA(Database Configuration Assistant).

How do we remove ASM from a Oracle RAC environment?

We need to stop and delete the instance in the node first in interactive or silent mode.After that asm can be removed using srvctl tool as follows:

srvctl stop asm -n node_name

srvctl remove asm -n node_name

We can verify if ASM has been removed by issuing the following command:

srvctl config asm -n node_name

How do we verify that an instance has been removed from OCR after deleting an instance?

Issue the following srvctl command:

srvctl config database -d database_name

cd CRS_HOME/bin

./crs_stat

How do we verify an existing current backup of OCR?

We can verify the current backup of OCR using the following command : ocrconfig -showbackup

What are the performance views in an Oracle RAC environment?

We have v$ views that are instance specific. In addition we have GV$ views called as global views that has an INST_ID column of numeric data type.GV$ views obtain information from individual V$ views.

What are the types of connection load-balancing?

There are two types of connection load-balancing:server-side load balancing and client-side load balancing.

What is the differnece between server-side and client-side connection load balancing?

Client-side balancing happens at client side where load balancing is done using listener.In case of server-side load balancing listener uses a load-balancing advisory to redirect connections to the instance providing best service.

Give the usage of srvctl:-

srvctl start instance -d db_name -i "inst_name_list" [-o start_options]srvctl stop instance -d name -i "inst_name_list" [-o stop_options]srvctl stop instance -d orcl -i "orcl3,orcl4" -o immediatesrvctl start database -d name [-o start_options]srvctl stop database -d name [-o stop_options]srvctl start database -d orcl -o mount


Oracle DBA Interview questions -

 1. How many memory layers are in the shared pool? 
2. How do you find out from the RMAN catalog if a particular archive log has been backed-up? 
3. How can you tell how much space is left on a given file system and how much space each of the file system’s subdirectories take-up? 
df -h
du -h
4. Define the SGA and how you would configure SGA for a mid-sized OLTP environment? What is involved in tuning the SGA? 
5. What is the cache hit ratio, what impact does it have on performance of an Oracle database and what is involved in tuning it? 
6. Other than making use of the statspack utility, what would you check when you are monitoring or running a health check on an Oracle 8i or 9i database? 
7. How do you tell what your machine name is and what is its IP address? 
1.uname -n
2.ifconfig -a
8. How would you go about verifying the network name that the local_listener is currently using? 
LSNRCTL> show current_listener
Current Listener is LISTENER
LSNRCTL> show log_status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname.domain.net)(PORT=1521)))
LISTENER parameter “log_status” set to ON
The command completed successfully
LSNRCTL>
9. You have 4 instances running on the same UNIX box. How can you determine which shared memory and semaphores are associated with which instance? 
10. What view(s) do you use to associate a user’s SQLPLUS session with his o/s process? 
11. What is the recommended interval at which to run statspack snapshots, and why? 
12. What spfile/init.ora file parameter exists to force the CBO to make the execution path of a given statement use an index, even if the index scan may appear to be calculated as more costly? 
13. Assuming today is Monday, how would you use the DBMS_JOB package to schedule the execution of a given procedure owned by SCOTT to start Wednesday at 9AM and to run subsequently every other day at 2AM. 
14. How would you edit your CRONTAB to schedule the running of /test/test.sh to run every other day at 2PM? 
15. What do the 9i dbms_standard.sql_txt() and dbms_standard.sql_text() procedures do? 
16. In which dictionary table or view would you look to determine at which time a snapshot or MVIEW last successfully refreshed? 
17. How would you best determine why your MVIEW couldn’t FAST REFRESH? 
18. How does propagation differ between Advanced Replication and Snapshot Replication (read-only)? 
19. Which dictionary view(s) would you first look at to understand or get a high-level idea of a given Advanced Replication environment? 
20. How would you begin to troubleshoot an ORA-3113 error? 
ORA-03113 –> An unexpected end-of-file was processed on the communication channel. This message could occur if the shadow two-task process associated with a Net8 connect has terminated abnormally, or if there is a physical failure of the interprocess communication vehicle, that is, the network or server machine went down. This message could occur when any of the following commands have been issued: 
ALTER SYSTEM KILL SESSION … IMMEDIATE 
ALTER SYSTEM DISCONNECT SESSION … IMMEDIATE 
SHUTDOWN ABORT/IMMEDIATE/TRANSACTIONAL 
If this message occurs during a connection attempt, check the setup files for the appropriate Net8 driver and confirm Net8 software is correctly installed on the server. If the message occurs after a connection is well established, and the error is not due to a physical failure, check if a trace file was generated on the server at failure time. Existence of a trace file may suggest an Oracle internal error that requires the assistance of Oracle Support Services.
21. Which dictionary tables and/or views would you look at to diagnose a locking issue? 
1.v$locked_object
2.v$lock
22. An automatic job running via DBMS_JOB has failed. Knowing only that “it’s failed”, how do you approach troubleshooting this issue? 
23. How would you extract DDL of a table without using a GUI tool? 
Use DBMS_METADATA package and use GET_DDL procedure.
24. You’re getting high “busy buffer waits” - how can you find what’s causing it? 
25. What query tells you how much space a tablespace named “test” is taking up, and how much space is remaining? 
26. Database is hung. Old and new user connections alike hang on impact. What do you do? Your SYS SQLPLUS session IS able to connect. 
  I  think it looks like Archive log destination is full.
1.If you have seperate backup script for archive log please use that.
2.Or move some archive log fils to diffrent location to get free space.
3.Try to connect the DB now.
27. Database crashes. Corruption is found scattered among the file system neither of your doing nor of Oracle’s. What database recovery options are available? Database is in archive log mode. 
28. Illustrate how to determine the amount of physical CPUs a Unix Box possesses (LINUX and/or Solaris). 
29. How do you increase the OS limitation for open files (LINUX and/or Solaris)? 
30. Provide an example of a shell script which logs into SQLPLUS as SYS, determines the current date, changes the date format to include minutes & seconds, issues a drop table command, displays the date again, and finally exits. 
31. Explain how you would restore a database using RMAN to Point in Time? 
Shut down the target database if it is open
Mount the target database
Check the format of NLS_LANG & NLS_DATE_FORMAT variables
Start RMAN and connect to target database
run{
set until time ’specify the time u want to recover the database
upto’;
RESTORE DATABASE;
RECOVER DATABASE;
ALTER DATABASE OPEN RESETLOGS;
}
32. How does Oracle guarantee data integrity of data changes? 
33. Which environment variables are absolutely critical in order to run the OUI? 
ORACLE_HOME, ORACLE_SID,ORACLE_BASE,PATH & LD_LIBRARY_PATH
34. What SQL query from v$session can you run to show how many sessions are logged in as a particular user account? 
SELECT username, COUNT(*) count
FROM v$session
GROUP BY username;
35. Why does Oracle not permit the use of PCTUSED with indexes? 
This is because an index is a complex data structure, not randomly organized like a heap table ( a normal table u get when u type create table syntax) Data must go where it ‘belongs’. Unlike a heap where blocks are sometimes available for inserts, blocks are always available for new entries in an index. If the data belongs on a given block because of its values, it will go there regardless of how full or empty the block is. 
PCTFREE will reserve space on a newly created index, but not for subsequent operations on it for much the same reason as why
PCTUSED is not used at all.
The same thigh is true even for index organized tables too…
36. What would you use to improve performance on an insert statement that places millions of rows into that table? 
1.Disable the constraint.
2.Drop the non-unique indexes.
3.Set Undo tablespace properly.
4.Create a big redo log groups.
37. What would you do with an “in-doubt” distributed transaction? 
38. What are the commands you’d issue to show the explain plan for “select * from dual”? 
39. In what script is “snap$” created? In what script is the “scott/tiger” schema created? 
40. If you’re unsure in which script a sys or system-owned object is created, but you know it’s in a script from a specific directory, what UNIX command from that directory structure can you run to find your answer? 
41. How would you configure your networking files to connect to a database by the name of DSS which resides in domain icallinc.com? 
42. You create a private database link and upon connection, fails with: ORA-2085: connects to . What is the problem? How would you go about resolving this error? 
43. I have my backup RMAN script called “backup_rman.sh”. I am on the target database. My catalog username/password is rman/rman. My catalog db is called rman. How would you run this shell script from the O/S such that it would run as a background process? 
44. Explain the concept of the DUAL table. 
Dual is a table which is created by oracle along with the data dictionary. It consists of exactly one column whose name is dummy and one record. The value of that record is X. Like 
SQL> desc dual
Name Null? Type
———————– ——– —————-
DUMMY VARCHAR2(1)
SQL> select * from dual;
D
-
X
45. What are the ways tablespaces can be managed and how do they differ? 
.Dictionary managed and locally managed.
Dictionary managed.
——————-
Here To allocate next extent it gets free blocks info from data dictionary every time, it’s a i/o contention issue.
Locally managed.
—————
In Locally managed tablespace free blocks information is available as bitmap in data file headers. No need to go dictionary.
SEGMENT SPACE MANAGEMENT AUTO option is still useful with LMT
46. From the database level, how can you tell under which time zone a database is operating? 
47. What’s the benefit of “dbms_stats” over “analyze”? 
48. Typically, where is the conventional directory structure chosen for Oracle binaries to reside? 
49. You have found corruption in a tablespace that contains static tables that are part of a database that is in NOARCHIVE log mode. How would you restore the tablespace without losing new data in the other tablespaces? 
50. How do you recover a datafile that has not been physically been backed up since its creation and has been deleted. Provide syntax example. 
How do you return the top-N results of a query in Oracle? Why doesn't the obvious method work? 
Most people think of using the ROWNUM pseudocolumn with ORDER BY. Unfortunately the ROWNUM is determined *before* the ORDER BY so you don't get the results you want. The answer is to use a subquery to do the ORDER BY first. For example to return the top-5 employees by salary:
SELECT * FROM (SELECT * FROM employees ORDER BY salary) WHERE ROWNUM < 5;
Describe the Oracle Wait Interface, how it works, and what it provides. What are some limitations? What do the db_file_sequential_read and db_file_scattered_read events indicate?
The Oracle Wait Interface refers to Oracle's data dictionary for managing wait events. Selecting from tables such as v$system_event and v$session_event give you event totals through the life of the database (or session). The former are totals for the whole system, and latter on a per session basis. The event db_file_sequential_read refers to single block reads, and table accesses by rowid. db_file_scattered_read conversely refers to full table scans. It is so named because the blocks are read, and scattered into the buffer cache. 
Every DBA should know something about the operating system that the database will be running on. The questions here are related to UNIX but you should equally be able to answer questions related to common Windows environments.
1. How do you list the files in an UNIX directory while also showing hidden files?
ls -ltra
2. How do you execute a UNIX command in the background?
Use the "&"
3. What UNIX command will control the default file permissions when files are created?
Umask
4. Explain the read, write, and execute permissions on a UNIX directory.
Read allows you to see and list the directory contents.
Write allows you to create, edit and delete files and subdirectories in the directory.
Execute gives you the previous read/write permissions plus allows you to change into the directory and execute programs or shells from the directory.
5. the difference between a soft link and a hard link?
A symbolic (soft) linked file and the targeted file can be located on the same or different file system while for a hard link they must be located on the same file system.
6. Give the command to display space usage on the UNIX file system.
df -lk
7. Explain iostat, vmstat and netstat.
Iostat reports on terminal, disk and tape I/O activity.
Vmstat reports on virtual memory statistics for processes, disk, tape and CPU activity.
Netstat reports on the contents of network data structures.
8. How would you change all occurrences of a value using VI?
Use :%s///g
9. Give two UNIX kernel parameters that effect an Oracle install
SHMMAX & SHMMNI
10. Briefly, how do you install Oracle software on UNIX.
Basically, set up disks, kernel parameters, and run orainst.





Important Oracle background processes:

 


ARCH - (Optional) Archive process writes filled redo logs to the archive log location(s). In RAC, the various ARCH processes can be utilized to ensure that copies of the archived redo logs for each instance are available to the other instances in the RAC setup should they be needed for recovery.

CJQ - Job Queue Process (CJQ) - Used for the job scheduler. The job scheduler includes a main program (the coordinator) and slave programs that the coordinator executes. The parameter job_queue_processes controls how many parallel job scheduler jobs can be executed at one time.

CKPT - Checkpoint process writes checkpoint information to control files and data file headers.

CQJ0 - Job queue controller process wakes up periodically and checks the job log. If a job is due, it spawns Jnnnn processes to handle jobs.

DBWR - Database Writer or Dirty Buffer Writer process is responsible for writing dirty buffers from the database block cache to the database data files. Generally, DBWR only writes blocks back to the data files on commit, or when the cache is full and space has to be made for more blocks. The possible multiple DBWR processes in RAC must be coordinated through the locking and global cache processes to ensure efficient processing is accomplished.

FMON - The database communicates with the mapping libraries provided by storage vendors through an external non-Oracle Database process that is spawned by a background process called FMON. FMON is responsible for managing the mapping information. When you specify the FILE_MAPPING initialization parameter for mapping data files to physical devices on a storage subsystem, then the FMON process is spawned.

LGWR - Log Writer process is responsible for writing the log buffers out to the redo logs. In RAC, each RAC instance has its own LGWR process that maintains that instance’s thread of redo logs.

LMON - Lock Manager process

MMON - The Oracle 10g background process to collect statistics for the Automatic Workload Repository (AWR).

MMNL - This process performs frequent and lightweight manageability-related tasks, such as session history capture and metrics computation.



MMAN - is used for internal database tasks that manage the automatic shared memory. MMAN serves as the SGA Memory Broker and coordinates the sizing of the memory components. 

PMON - Process Monitor process recovers failed process resources. If MTS (also called Shared Server Architecture) is being utilized, PMON monitors and restarts any failed dispatcher or server processes. In RAC, PMON’s role as service registration agent is particularly important.

Pnnn - (Optional) Parallel Query Slaves are started and stopped as needed to participate in parallel query operations.

RBAL - This process coordinates rebalance activity for disk groups in an Automatic Storage Management instance. 

SMON - System Monitor process recovers after instance failure and monitors temporary segments and extents. SMON in a non-failed instance can also perform failed instance recovery for other failed RAC instance.

WMON - The "wakeup" monitor process

 

Data Guard/Streams/replication Background processes

DMON - The Data Guard Broker process. 

SNP - The snapshot process.

MRP - Managed recovery process - For Data Guard, the background process that applies archived redo log to the standby database. 

ORBn - performs the actual rebalance data extent movements in an Automatic Storage Management instance. There can be many of these at a time, called ORB0, ORB1, and so forth.


OSMB - is present in a database instance using an Automatic Storage Management disk group. It communicates with the Automatic Storage Management instance.

RFS - Remote File Server process - In Data Guard, the remote file server process on the standby database receives archived redo logs from the primary database. 


QMN - Queue Monitor Process (QMNn) - Used to manage Oracle Streams Advanced Queuing.

 

Oracle Real Application Clusters (RAC) Background Processes


The following are the additional processes spawned for supporting the multi-instance coordination:

DIAG: Diagnosability Daemon – Monitors the health of the instance and captures the data for instance process failures.

LCKx - This process manages the global enqueue requests and the cross-instance broadcast. Workload is automatically shared and balanced when there are multiple Global Cache Service Processes (LMSx).

LMON - The Global Enqueue Service Monitor (LMON) monitors the entire cluster to manage the global enqueues and the resources. LMON manages instance and process failures and the associated recovery for the Global Cache Service (GCS) and Global Enqueue Service (GES). In particular, LMON handles the part of recovery associated with global resources. LMON-provided services are also known as cluster group services (CGS)


LMDx - The Global Enqueue Service Daemon (LMD) is the lock agent process that manages enqueue manager service requests for Global Cache Service enqueues to control access to global enqueues and resources. The LMD process also handles deadlock detection and remote enqueue requests. Remote resource requests are the requests originating from another instance.

LMSx - The Global Cache Service Processes (LMSx) are the processes that handle remote Global Cache Service (GCS) messages. Real Application Clusters software provides for up to 10 Global Cache Service Processes. The number of LMSx varies depending on the amount of messaging traffic among nodes in the cluster. 

The LMSx handles the acquisition interrupt and blocking interrupt requests from the remote instances for Global Cache Service resources. For cross-instance consistent read requests, the LMSx will create a consistent read version of the block and send it to the requesting instance. The LMSx also controls the flow of messages to remote instances.

The LMSn processes handle the blocking interrupts from the remote instance for the Global Cache Service resources by:


Creating a Physical Standby Database

 Preparing the Primary Database for Standby Database Creation


Before you create a standby database you must first ensure that the primary

database is properly configured.


Enable Forced Logging


Place the primary database in FORCE LOGGING mode after database creation using

the following SQL statement:


SQL> ALTER DATABASE FORCE LOGGING;


This statement may take a considerable amount of time to complete, because it

waits for all unlogged direct write I/O operations to finish.


Enable Archiving and Define a Local Archiving Destination


Ensure that the primary database is in ARCHIVELOG mode, that automatic

archiving is enabled, and that you have defined a local archiving destination.

Set the local archive destination using the following SQL statement:


SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1=’LOCATION=/disk1/oracle/oradata/payroll

2> MANDATORY’ SCOPE=BOTH;


Creating a Physical Standby Database



Identify the Primary Database Datafiles


On the primary database, query the V$DATAFILE view to list the files that will be

used to create the physical standby database, as follows:


SQL> SELECT NAME FROM V$DATAFILE;

NAME

----------------------------------------------------------------------------

/disk1/oracle/oradata/payroll/system01.dbf

/disk1/oracle/oradata/payroll/undotbs01.dbf

/disk1/oracle/oradata/payroll/cwmlite01.dbf

.

.

.



Make a Copy of the Primary Database


On the primary database, perform the following steps to make a closed backup

copy of the primary database.

Step 1 Shut down the primary database.

Issue the following SQL*Plus statement to shut down the primary database:

SQL> SHUTDOWN IMMEDIATE;

Step 2 Copy the datafiles to a temporary location.

Copy the datafiles that you identified in v$datafile to a temporary location using

an operating system utility copy command. The following example uses the UNIX

cp command:


cp /disk1/oracle/oradata/payroll/system01.dbf

/disk1/oracle/oradata/payroll/standby/system01.dbf

Copying the datafiles to a temporary location will reduce the amount of time that

the primary database must remain shut down.

Step 3 Restart the primary database.

Issue the following SQL*Plus statement to restart the primary database:

SQL> STARTUP;


Create a Control File for the Standby Database


On the primary database, create the control file for the standby database, as shown

in the following example:

SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS

2> '/disk1/oracle/oradata/payroll/standby/payroll2.ctl';


Note: You cannot use a single control file for both the primary and

standby databases.


The filename for the newly created standby control file must be different from the

filename of the current control file of the primary database. The control file must

also be created after the last time stamp for the backup datafiles.


Prepare the Initialization Parameter File to be Copied to the Standby Database


Create a traditional text initialization parameter file from the server parameter file

used by the primary database; a traditional text initialization parameter file can be

copied to the standby location and modified. For example:


SQL> CREATE PFILE=’/disk1/oracle/dbs/initpayroll2.ora’ FROM SPFILE;


Later, you will convert this file back to a server parameter file after

it is modified to contain the parameter values appropriate for use with the physical

standby database.



Copy Files from the Primary System to the Standby System


On the primary system, use an operating system copy utility to copy the following

binary files from the primary system to the standby system:


Backup datafiles 

Standby control file 

Initialization parameter 


Set Initialization Parameters on a Physical Standby Database


Although most of the initialization parameter settings in the text initialization

parameter file that you copied from the primary system are also appropriate for the

Physical standby database, some modifications need to be made.


Modifying Initialization Parameters for a Physical Standby Database


.

.

.

db_name=PAYROLL

compatible=9.2.0.1.0

control_files=’/disk1/oracle/oradata/payroll/standby/payroll2.ctl’

log_archive_start=TRUE

standby_archive_dest=’/disk1/oracle/oradata/payroll/standby’

db_file_name_convert=(’/disk1/oracle/oradata/payroll/’,

’/disk1/oracle/oradata/payroll/standby/’)

log_file_name_convert=(’/disk1/oracle/oradata/payroll/’,

’/disk1/oracle/oradata/payroll/standby/’)

log_archive_format=log%d_%t_%s.arc

log_archive_dest_1=(’LOCATION=/disk1/oracle/oradata/payroll/standby/’)

standby_file_management=AUTO

remote_archive_enable=TRUE

instance_name=PAYROLL2


# The following parameter is required only if the primary and standby databases

# are located on the same system.


lock_name_space=PAYROLL2

.

.

.


Caution: Review the initialization parameter file for additional

parameters that may need to be modified. For example, you may

need to modify the dump destination parameters (background_

dump_dest, core_dump_dest, user_dump_dest) if the

directory location on the standby database is different from those

specified on the primary database. In addition, you may have to

create some directories on the standby system if they do not

already exist.


Configure Listeners for the Primary and Standby Databases


On both the primary and standby sites, use Oracle Net Manager to configure a

listener for the respective databases. If you plan to manage the configuration using

the Data Guard broker, you must configure the listener to use the TCP/IP protocol

and statically register service information for each database using the SID for the

database instance.


To restart the listeners (to pick up the new definitions), enter the following

LSNRCTL utility commands on both the primary and standby systems:


% lsnrctl stop

% lsnrctl start


Enable Dead Connection Detection on the Standby System


Enable dead connection detection by setting the SQLNET.EXPIRE_TIME parameter

to 2 in the SQLNET.ORA parameter file on the standby system. For example:


SQLNET.EXPIRE_TIME=2


Create Oracle Net Service Names


On both the primary and standby systems, use Oracle Net Manager to create a

network service name for the primary and standby databases that will be used by

log transport services.


The Oracle Net service name must resolve to a connect descriptor that uses the

same protocol, host address, port, and SID that you specified when you configured

the listeners for the primary and standby databases. The connect descriptor must

also specify that a dedicated server be used.


Create a Server Parameter File for the Standby Database


On an idle standby database, use the SQL CREATE statement to create a server

parameter file for the standby database from the text initialization parameter file

that was edited. For example:


SQL> CREATE SPFILE FROM PFILE=’initpayroll2.ora’;



Start the Physical Standby Database


On the standby database, issue the following SQL statements to start and mount the

database in standby mode:


SQL> STARTUP NOMOUNT;

SQL> ALTER DATABASE MOUNT STANDBY DATABASE;


Initiate Log Apply Services


On the standby database, start log apply services as shown in the following

example:


SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;


The example includes the DISCONNECT FROM SESSION option so that log apply

services run in a background session.


Enable Archiving to the Physical Standby Database


This section describes the minimum amount of work you must do on the primary

database to set up and enable archiving to the physical standby database.


Set initialization parameters to define archiving


To configure archive logging from the primary database to the standby site the

LOG_ARCHIVE_DEST_n and LOG_ARCHIVE_DEST_STATE_n parameters must be

defined.


The following example sets the initialization parameters needed to enable archive

logging to the standby site:


SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=payroll2’ SCOPE=BOTH;

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE SCOPE=BOTH;


Start remote archiving


Archiving of redo logs to the remote standby location does not occur until after a

log switch. A log switch occurs, by default, when an online redo log becomes full.

To force the current redo logs to be archived immediately, use the SQL ALTER

SYSTEM statement on the primary database. For example:


SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;


Verifying the Physical Standby Database


Once you create the physical standby database and set up log transport services,

you may want verify that database modifications are being successfully shipped

from the primary database to the standby database.


To see the new archived redo logs that were received on the standby database, you

should first identify the existing archived redo logs on the standby database,

archive a few logs on the primary database, and then check the standby database

again. The following steps show how to perform these tasks.


Step 1 Identify the existing archived redo logs.

On the standby database, query the V$ARCHIVED_LOG view to identify existing

archived redo logs. For example:


SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME

2 FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;


SEQUENCE# FIRST_TIME NEXT_TIME

---------- ------------------ ------------------

8 11-JUL-02 17:50:45 11-JUL-02 17:50:53

9 11-JUL-02 17:50:53 11-JUL-02 17:50:58

10 11-JUL-02 17:50:58 11-JUL-02 17:51:03


3 rows selected.


Archiving the current log


On the primary database, archive the current log using the following SQL

Statement:


SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;


Verify that the new archived redo log was received


On the standby database, query the V$ARCHIVED_LOG view to verify the redo log

was received:


SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME

2> FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;


SEQUENCE# FIRST_TIME NEXT_TIME

---------- ------------------ ------------------

8 11-JUL-02 17:50:45 11-JUL-02 17:50:53

9 11-JUL-02 17:50:53 11-JUL-02 17:50:58

10 11-JUL-02 17:50:58 11-JUL-02 17:51:03

11 11-JUL-02 17:51:03 11-JUL-02 18:34:11


4 rows selected.

The logs are now available for log apply services to apply redo data to the standby

database.


Verify that the new archived redo log was applied


On the standby database, query the V$ARCHIVED_LOG view to verify the archived

redo log was applied.


SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG

2 ORDER BY SEQUENCE#;


SEQUENCE# APP

--------- ---

8 YES

9 YES

10 YES

11 YES


4 rows selected.





Rman clone on same system

 Clone an Oracle database using RMAN duplicate (same server)

tnsManager - Distribute tnsnames the easy way and for free!

This procedure will clone a database onto the same server using RMAN duplicate.

• 1. Backup the source database.

To use RMAN duplicate an RMAN backup of the source database is required. If there is already one available, skip to step 2. If not, here is a quick example of how to produce an RMAN backup. This example assumes that there is no recovery catalog available:

rman target sys@<source database> nocatalog


backup database plus archivelog format '/u01/ora_backup/rman/%d_%u_%s';


This will backup the database and archive logs. The format string defines the location of the backup files. Alter it to a suitable location.

• 2. Produce a pfile for the new database

This step assumes that the source database is using a spfile. If that is not the case, simply make a copy the existing pfile.


Connect to the source database as sysdba and run the following:

create pfile='init<new database sid>.ora' from spfile;


This will create a new pfile in the $ORACLE_HOME/dbs directory.


The new pfile will need to be edited immediately. If the cloned database is to have a different name to the source, this will need to be changed, as will any paths. Review the contents of the file and make alterations as necessary.


Because in this example the cloned database will reside on the same machine as the source, Oracle must be told how convert the filenames during the RMAN duplicate operation. This is achieved by adding the following lines to the newly created pfile:

db_file_name_convert=(<source_db_path>,<target_db_path>)

log_file_name_convert=(<source_db_path>,<target_db_path>)


Here is an example where the source database scr9 is being cloned to dg9a. Note the trailing slashes and lack of quotes:


db_file_name_convert=(/u01/oradata/scr9/,/u03/oradata/dg9a/)

log_file_name_convert=(/u01/oradata/scr9/,/u03/oradata/dg9a/)


• 3. Create bdump, udump & cdump directories

Create bdump, udump & cdump directories as specified in the pfile from the previous step.

• 4. Add a new entry to oratab, and source the environment

Edit the /etc/oratab (or /opt/oracle/oratab) and add an entry for the new database.


Source the new environment with '. oraenv' and verify that it has worked by issuing the following command:

echo $ORACLE_SID


If this doesn't output the new database sid go back and investigate why not.

• 5. Create a password file

Use the following command to create a password file (add an appropriate password to the end of it):

orapwd file=${ORACLE_HOME}/dbs/orapw${ORACLE_SID} password=<your password>


• 6. Duplicate the database

From sqlplus, start the instance up in nomount mode:

startup nomount


Exit sqlplus, start RMAN and duplicate the database. As in step 1, it is assumed that no recovery catalog is available. If one is available, simply amend the RMAN command to include it.

rman target sys@<source_database> nocatalog auxiliary /


duplicate target database to <clone database name>;


This will restore the database and apply some archive logs. It can appear to hang at the end sometimes. Just give it time - I think it is because RMAN does a 'shutdown normal'.


If you see the following error, it is probably due to the file_name_convert settings being wrong. Return to step 2 and double check the settings.

RMAN-05001: auxiliary filename '%s' conflicts with a file used by the target database


Once the duplicate has finished RMAN will display a message similar to this:


database opened

Finished Duplicate Db at 26-FEB-05


RMAN>


Exit RMAN.

• 7. Create an spfile

From sqlplus:

create spfile from pfile;


shutdown immediate

startup


Now that the clone is built, we no longer need the file_name_convert settings:

alter system reset db_file_name_convert scope=spfile sid='*'

/


alter system reset log_file_name_convert scope=spfile sid='*'

/


• 8. Optionally take the clone database out of archive log mode

RMAN will leave the cloned database in archive log mode. If archive log mode isn't required, run the following commands from sqlplus:

shutdown immediate

startup mount

alter database noarchivelog;

alter database open;


• 9. Configure TNS

Add entries for new database in the listener.ora and tnsnames.ora as necessary.


Duplicate Oracle Database with RMAN

 
A powerful feature of RMAN is the ability to duplicate (clone), a database from a backup. It is possible to create a duplicate database on:
o A remote server with the same file structure
o A remote server with a different file structure
o The local server with a different file structure
A duplicate database 
 
is distinct from a standby database, although both types of databases are created with the DUPLICATE command. A standby database is a copy of the primary database that you can update continually or periodically by using archived logs from the primary database. If the primary database is damaged or destroyed, then you can perform failover to the standby database and effectively transform it into the new primary database. A duplicate database, on the other hand, cannot be used in this way: it is not intended for failover scenarios and does not support the various standby recovery and failover options.
To prepare for database duplication, you must first create an auxiliary instance. For the duplication to work, you must connect RMAN to both the target (primary) database and an auxiliary instance started in NOMOUNT mode.
So long as RMAN is able to connect to the primary and duplicate instances, the RMAN client can run on any machine. However, all backups, copies of datafiles, and archived logs used for creating and recovering the duplicate database must be accessible by the server session on the duplicate host.
As part of the duplicating operation, RMAN manages the following:
o Restores the target datafiles to the duplicate database and performs incomplete recovery by using all available backups and archived logs.
 
o Shuts down and starts the auxiliary database.
 
o Opens the duplicate database with the RESETLOGS option after incomplete recovery to create the online redo logs.
 
o Generates a new, unique DBID for the duplicate database.
Preparing the Duplicate (Auxiliary) Instance for Duplication
Create an Oracle Password File
First we must create a password file for the duplicate instance.
export ORACLE_SID=APP2
orapwd file=orapwAPP2 password=manager entries=5 force=y
Ensure Oracle Net Connectivity to both Instances
Next add the appropriate entries into the TNSNAMES.ORA and LISTENER.ORA files in the $TNS_ADMIN directory.
LISTENER.ORA
APP1 = Target Database, APP2 = Auxiliary Database
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = gentic)(PORT = 1521))
    )
  )
 
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = APP1.WORLD)
      (ORACLE_HOME = /opt/oracle/product/10.2.0)
      (SID_NAME = APP1)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = APP2.WORLD)
      (ORACLE_HOME = /opt/oracle/product/10.2.0)
      (SID_NAME = APP2)
    )
  )
TNSNAMES.ORA
APP1 = Target Database, APP2 = Auxiliary Database
APP1.WORLD =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = gentic)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = APP1.WORLD)
    )
  )
 
APP2.WORLD =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = gentic)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = APP2.WORLD)
    )
  )
SQLNET.ORA
NAMES.DIRECTORY_PATH= (TNSNAMES)
NAMES.DEFAULT_DOMAIN = WORLD
NAME.DEFAULT_ZONE = WORLD
USE_DEDICATED_SERVER = ON
Now restart the Listener
lsnrctl stop
lsnrctl start
Create an Initialization Parameter File for the Auxiliary Instance
Create an INIT.ORA parameter file for the auxiliary instance, you can copy that from the target instance and then modify the parameters.
### Duplicate Database
### -----------------------------------------------
# This is only used when you duplicate the database
# on the same host to avoid name conflicts
 
DB_FILE_NAME_CONVERT              = (/u01/oracle/db/APP1/,/u01/oracle/db/APP2/)
LOG_FILE_NAME_CONVERT             = (/u01/oracle/db/APP1/,/u01/oracle/db/APP2/,
                                     /opt/oracle/db/APP1/,/opt/oracle/db/APP2/)
 
### Global database name is db_name.db_domain
### -----------------------------------------
 
db_name                           = APP2
db_unique_name                    = APP2_GENTIC
db_domain                         = WORLD
service_names                     = APP2
instance_name                     = APP2
 
### Basic Configuration Parameters
### ------------------------------
 
compatible                        = 10.2.0.4
db_block_size                     = 8192
db_file_multiblock_read_count     = 32
db_files                          = 512
control_files                     = /u01/oracle/db/APP2/con/APP2_con01.con,
                                    /opt/oracle/db/APP2/con/APP2_con02.con
 
### Database Buffer Cache, I/O
### --------------------------
# The Parameter SGA_TARGET enables Automatic Shared Memory Management
 
sga_target                        = 500M
sga_max_size                      = 600M
 
### REDO Logging without Data Guard
### -------------------------------
 
log_archive_format                = APP2_%s_%t_%r.arc
log_archive_max_processes         = 2
log_archive_dest                  = /u01/oracle/db/APP2/arc
 
### System Managed Undo
### -------------------
 
undo_management                   = auto
undo_retention                    = 10800
undo_tablespace                   = undo
 
### Traces, Dumps and Passwordfile
### ------------------------------
 
audit_file_dest                   = /u01/oracle/db/APP2/adm/admp
user_dump_dest                    = /u01/oracle/db/APP2/adm/udmp
background_dump_dest              = /u01/oracle/db/APP2/adm/bdmp
core_dump_dest                    = /u01/oracle/db/APP2/adm/cdmp
utl_file_dir                      = /u01/oracle/db/APP2/adm/utld
remote_login_passwordfile         = exclusive
Create a full Database Backup
Make sure that a full backup of the target is accessible on the duplicate host. You can use the following BASH script to backup the target database.
rman nocatalog target / <<-EOF
   configure retention policy to recovery window of 3 days;
   configure backup optimization on;
   configure controlfile autobackup on;
   configure default device type to disk;
   configure device type disk parallelism 1 backup type to compressed backupset;
   configure datafile backup copies for device type disk to 1;
   configure maxsetsize to unlimited;
   configure snapshot controlfile name to '/u01/backup/snapshot_controlfile';
   show all;
 
   run {
     allocate channel ch1 type Disk maxpiecesize = 1900M;
     backup full database noexclude
     include current controlfile
     format '/u01/backup/datafile_%s_%p.bak'
     tag 'datafile_daily';
   }
 
   run {
     allocate channel ch1 type Disk maxpiecesize = 1900M;
     backup archivelog all
     delete all input
     format '/u01/backup/archivelog_%s_%p.bak'
     tag 'archivelog_daily';
   }
 
   run {
      allocate channel ch1 type Disk maxpiecesize = 1900M;
      backup format '/u01/backup/controlfile_%s.bak' current controlfile;
   }
 
   crosscheck backup;
   list backup of database;
   report unrecoverable;
   report schema;
   report need backup;
   report obsolete;
   delete noprompt expired backup of database;
   delete noprompt expired backup of controlfile;
   delete noprompt expired backup of archivelog all;
   delete noprompt obsolete recovery window of 3 days;
   quit
EOF
Creating a Duplicate Database on the Local Host
Before beginning RMAN duplication, use SQL*Plus to connect to the auxiliary instance and start it in NOMOUNT mode. If you do not have a server-side initialization parameter file for the auxiliary instance in the default location, then you must specify the client-side initialization parameter file with the PFILE parameter on the DUPLICATE command.
 
Get original Filenames from TARGET
To rename the database files you can use the SET NEWNAME command. Therefore, get the original filenames from the target and modify these names in the DUPLICATE command.
ORACLE_SID=APP1
export ORACLE_SID
set feed off
set pagesize 10000
column name format a40 heading "Datafile"
column file# format 99 heading "File-ID"
 
select  name, file# from v$dbfile;
 
column member format a40 heading "Logfile"
column group# format 99 heading "Group-Nr"
 
select  member, group# from v$logfile;
 
Datafile                                  File-ID
----------------------------------------  -------
/u01/oracle/db/APP1/sys/APP1_sys1.dbf           1
/u01/oracle/db/APP1/sys/APP1_undo1.dbf          2
/u01/oracle/db/APP1/sys/APP1_sysaux1.dbf        3
/u01/oracle/db/APP1/usr/APP1_users1.dbf         4
 
Logfile                                  Group-Nr
---------------------------------------- --------
/u01/oracle/db/APP1/rdo/APP1_log1A.rdo          1
/opt/oracle/db/APP1/rdo/APP1_log1B.rdo          1
/u01/oracle/db/APP1/rdo/APP1_log2A.rdo          2
/opt/oracle/db/APP1/rdo/APP1_log2B.rdo          2
/u01/oracle/db/APP1/rdo/APP1_log3A.rdo          3
/opt/oracle/db/APP1/rdo/APP1_log3B.rdo          3
/u01/oracle/db/APP1/rdo/APP1_log4A.rdo          4
/opt/oracle/db/APP1/rdo/APP1_log4B.rdo          4
/u01/oracle/db/APP1/rdo/APP1_log5A.rdo          5
/opt/oracle/db/APP1/rdo/APP1_log5B.rdo          5
/u01/oracle/db/APP1/rdo/APP1_log6A.rdo          6
/opt/oracle/db/APP1/rdo/APP1_log6B.rdo          6
/u01/oracle/db/APP1/rdo/APP1_log7A.rdo          7
/opt/oracle/db/APP1/rdo/APP1_log7B.rdo          7
/u01/oracle/db/APP1/rdo/APP1_log8A.rdo          8
/opt/oracle/db/APP1/rdo/APP1_log8B.rdo          8
/u01/oracle/db/APP1/rdo/APP1_log9A.rdo          9
/opt/oracle/db/APP1/rdo/APP1_log9B.rdo          9
/u01/oracle/db/APP1/rdo/APP1_log10A.rdo        10
/opt/oracle/db/APP1/rdo/APP1_log10B.rdo        10
Create Directories for the duplicate Database
mkdir -p /u01/oracle/db/APP2
mkdir -p /opt/oracle/db/APP2
cd /opt/oracle/db/APP2
mkdir con rdo
cd /u01/oracle/db/APP2
mkdir adm arc con rdo sys tmp usr bck
cd adm
mkdir admp bdmp cdmp udmp utld
Create Symbolic Links to Password and INIT.ORA File
Oracle must be able to locate the Password and INIT.ORA File.
cd $ORACLE_HOME/dbs
ln -s /home/oracle/config/10.2.0/orapwAPP2 orapwAPP2
ln -s /home/oracle/config/10.2.0/initAPP2.ora initAPP2.ora
Duplicate the Database
Now you are ready to duplicate the database APP1 to APP2.
ORACLE_SID=APP2
export ORACLE_SID
 
sqlplus sys/manager as sysdba
startup force nomount pfile='/home/oracle/config/10.2.0/initAPP2.ora';
exit;
rman TARGET sys/manager@APP1 AUXILIARY sys/manager@APP2
Recovery Manager: Release 10.2.0.4.0 - Production on Tue Oct 28 12:00:13 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: APP1 (DBID=3191823649)
connected to auxiliary database: APP2 (not mounted)
RUN
{
  SET NEWNAME FOR DATAFILE 1 TO '/u01/oracle/db/APP2/sys/APP2_sys1.dbf';
  SET NEWNAME FOR DATAFILE 2 TO '/u01/oracle/db/APP2/sys/APP2_undo1.dbf';
  SET NEWNAME FOR DATAFILE 3 TO '/u01/oracle/db/APP2/sys/APP2_sysaux1.dbf';
  SET NEWNAME FOR DATAFILE 4 TO '/u01/oracle/db/APP2/usr/APP2_users1.dbf';
  DUPLICATE TARGET DATABASE TO APP2
  PFILE = /home/oracle/config/10.2.0/initAPP2.ora
  NOFILENAMECHECK
  LOGFILE GROUP 1 ('/u01/oracle/db/APP2/rdo/APP2_log1A.rdo',
                   '/opt/oracle/db/APP2/rdo/APP2_log1B.rdo') SIZE 10M REUSE,
          GROUP 2 ('/u01/oracle/db/APP2/rdo/APP2_log2A.rdo',
                   '/opt/oracle/db/APP2/rdo/APP2_log2B.rdo') SIZE 10M REUSE,
          GROUP 3 ('/u01/oracle/db/APP2/rdo/APP2_log3A.rdo',
                   '/opt/oracle/db/APP2/rdo/APP2_log3B.rdo') SIZE 10M REUSE,
          GROUP 4 ('/u01/oracle/db/APP2/rdo/APP2_log4A.rdo',
                   '/opt/oracle/db/APP2/rdo/APP2_log4B.rdo') SIZE 10M REUSE,
          GROUP 5 ('/u01/oracle/db/APP2/rdo/APP2_log5A.rdo',
                   '/opt/oracle/db/APP2/rdo/APP2_log5B.rdo') SIZE 10M REUSE,
          GROUP 6 ('/u01/oracle/db/APP2/rdo/APP2_log6A.rdo',
                   '/opt/oracle/db/APP2/rdo/APP2_log6B.rdo') SIZE 10M REUSE,
          GROUP 7 ('/u01/oracle/db/APP2/rdo/APP2_log7A.rdo',
                   '/opt/oracle/db/APP2/rdo/APP2_log7B.rdo') SIZE 10M REUSE,
          GROUP 8 ('/u01/oracle/db/APP2/rdo/APP2_log8A.rdo',
                   '/opt/oracle/db/APP2/rdo/APP2_log8B.rdo') SIZE 10M REUSE,
          GROUP 9 ('/u01/oracle/db/APP2/rdo/APP2_log9A.rdo',
                   '/opt/oracle/db/APP2/rdo/APP2_log9B.rdo') SIZE 10M REUSE,
          GROUP 10 ('/u01/oracle/db/APP2/rdo/APP2_log10A.rdo',
                    '/opt/oracle/db/APP2/rdo/APP2_log10B.rdo') SIZE 10M REUSE;
}
The whole, long output is not shown here, but check, that RMAN was able to open the duplicate database with the RESETLOGS option.
.....
.....
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
 
database opened
Finished Duplicate Db at 28-OCT-08
As the final step, eliminate or uncomment the DB_FILE_NAME_CONVERT and LOG_FILE_NAME_CONVERT in the INIT.ORA file and restart the database.
initAPP2.ora
### Duplicate Database
### -----------------------------------------------
# This is only used when you duplicate the database
# on the same host to avoid name conflicts
# DB_FILE_NAME_CONVERT =  (/u01/oracle/db/APP1/,/u01/oracle/db/APP2/)
# LOG_FILE_NAME_CONVERT = (/u01/oracle/db/APP1/,/u01/oracle/db/APP2/,
                           /opt/oracle/db/APP1/,/opt/oracle/db/APP2/)
sqlplus / as sysdba
shutdown immediate;
startup;
Total System Global Area 629145600 bytes
Fixed Size 1269064 bytes
Variable Size 251658936 bytes
Database Buffers 373293056 bytes
Redo Buffers 2924544 bytes
Database mounted.
Database opened.
Creating a Duplicate Database to Remote Host
This scenario is exactly the same as described for the local host. Copy the RMAN Backup files to the remote host on the same directory as on the localhost.
 
cd /u01/backup
scp gentic:/u01/backup/* .
The other steps are the same as described under «Creating a Duplicate Database on the Local Host».
 


Transportable tablespace refresh

  1.check tablespace for the user which need to refresh -------------------------------------------------------------------  SQL> select ...