Wednesday, June 2, 2010

METALINK NOTES

Links to this post
=============================================
METALINK NOTE
=============================================

Note 458122.1 Installing and Configuring Csscan in 8i and 9i (Database Character Set Scanner)
211909.1 ORA-7445 related information.
144808.1 for more information and limits of using BYTE and CHAR semantics. This case will be added to this Note.

NOTE: The example shown above assumes that you only have one
Note 458122.1 Installing and Configuring Csscan in 8i and 9i (Database Character Set Scanner)
Note 745809.1 Installing and configuring Csscan in 10g and 11g (Database Character Set Scanner)
Note 444701.1 Csscan output explained
SQL> --Note we need to create all indexes
Make a note of the interface name (eth1 in the following example), then
186981.1 Oracle Application Server with Oracle E-Business Suite Release 11i

Physical Standby
*****************
Note:180031.1 Creating a DATA Guard physical standby
Note:214071.1 Creating a DATA Guard physical standby with DATA Guard Manager
Note:232649.1 Configuring gap resolution
Note:232240.1 Performing a switchover
Note:227196.1 Performing a failover
Note:187242.1 Applying Patchsets with Physical Standby in Place

Logical Standby
****************
Note:186150.1 Creating a logical standby
Note:214071.1 Creating a logical standby with DATA Guard Manager
Note:232240.1 Performing a switchover
Note:227196.1 Performing a failover
Note:233261.1 Tuning Log Apply Services
Note:215020.1 Troubleshooting Logical Standbys
Note:210989.1 Applying Patchsets with Logical Standby in Place
Note:233519.1 Known Issues with Logical Standby

Dataguard General Information
*****************************
Note:205637.1 Configuring Transparent Application Failover with DATA Guard
Note:233509.1 DATA Guard Frequently Asked Questions
Note:225633.1 Using SSH with 9i DATA Guard
Note:233425.1 Top DATA Guard Bugs
Note:219344.1 Usage, Benefits and Limitations of Standby RedoLogs
Note:201669.1 Setup and maintenance of DATA Guard Broker using DGMGRL
Note:203326.1 DATA Guard 9i Log Transportation on RAC
Note:239100.1 DATA Guard Protection Modes Explained

Dataguard Configuration Best Practices
**************************************
Note:240874.1 Primary Site and Network Configuration Best Practices
Note:240875.1 9i Media Recovery Best Practices

--------------RAC NOTE

Real Application Clusters(RAC)
*******************************
Note 338348.1
259301.1 CRS and 10g Real Application Clusters
178683.1 Tracing GSD, SRVCTL, GSDCTL, and SRVCONFIG
239998.1 10g RAC How to Clean Up After a Failed CRS Install
188135.1 Documentation Index for Real Application Clusters
268937.1 Repairing or Restoring an Inconsistent OCR in RAC
279793.1 How to Restore a Lost Voting Disk in 10g
292776.1 10g RAC Lessons Learned
452924.1 How to Prepare Storage for ASM,
239998.1 remove a failed CRS install
334567.1 Pre-Install checks for 10gR2 RDBMS (10.2.x) - SUN Solaris Platforms Refer to Doc ID:
181503.1 Real Application Clusters Whitepapers (OTN)
280209.1 10g RAC Performance Best Practices (INTERNAL ONLY)
302806.1 IBM General Parallel File System (GPFS) and Oracle RAC on AIX 5L and IBM eServer pSeries
270512.1 Adding a Node to a 10g RAC Cluster
268937.1 Repairing or Restoring an Inconsistent OCR in RAC
279793.1 How to Restore a Lost Voting Disk in 10g
292776.1 10g RAC Lessons Learned
137288.1 Manual Database Creation in Oracle9i (Single Instance and RAC)
292776.1 10g RAC Lessons Learned
280216.1 10g RAC Reference (INTERNAL ONLY)
269320.1 Removing a Node from a 10g RAC Cluster
226561.1 9iRAC Tuning Best Practices (INTERNAL ONLY)
220178.1 Installing and setting up ocfs on Linux - Basic Guide
208375.1 How To Convert A Single Instance Database To RAC In A Cluster File System Configuration
255359.1 Automatic Storage Management (ASM) and Oracle Cluster File System (OCFS) in Oracle10g
341963.1 10gR2 RAC Best Practices (INTERNAL ONLY)
273015.1 Migrating to RAC using DATA Guard
329530.1 Using Redhat Global File System (GFS) as shared storage for RAC
270901.1 How to Dynamically Add a New Node to an Existing 9.2.0 RAC Cluster
203326.1 DATA Guard 9i Log Transportation on RAC
169539.1 A Short Description of HA Options Available in 9i
160120.1 Oracle Real Application Clusters on Sun Cluster v3
226569.1 9iRAC Most Common Performance Problem Areas (INTERNAL ONLY)
251578.1 Step-By-Step Upgrade of Oracle Cluster File System (OCFS v1) on Linux
247135.1 How to Implement Load Balancing With RAC Configured System Using JDBC
139436.1 Understanding 9i Real Application Clusters Cache Fusion
285358.1 Creating a Logical Standby from a RAC Primary Using a Hot Backup
222288.1 9i Rel 2 RAC Running on IBM’s General Parallel File System
226567.1 9iRAC Related Init.ora Parameters (INTERNAL ONLY)
210889.1 RAC Installation with a NetApp Filer in Red Hat Linux Environment
341965.1 10gR2 RAC Reference (INTERNAL ONLY)
341969.1 10gR2 RAC OS Best Practices (INTERNAL ONLY)
226566.1 9iRAC Related Latches (INTERNAL ONLY)
220970.1 RAC: Frequently Asked Questions
268202.1 Dynamic node addition in a Linux cluster
285455.1 HOW TO MAKE AN EXCLUSIVE INSTANCE AVAILABLE ON MULTIPLE CLUSTER NODES.
332257.1 Using Oracle Clusterware with Vendor Clusterware FAQ
245079.1 Steps to clone a 11i RAC environment to a non-RAC environment
235158.1 How To Enable/Disbale Archive Log Mode on Oracle9i Real Application Cluster
210022.1 How To Add A New Instance To The Existing Two Nodes RAC Database Manually
317516.1 Adding and Deleting a Cluster Node on 10gR2 / Linux
271685.1 How to Run Autoconfig for RAC Environment on Apps Tier Only
278816.1 How to Setup Parallel Concurrent Processing using Shared APPL_TOP for RAC Environment
334459.1 How to change hostname in RAC environment
250378.1 Migrating Applications 11i to use Oracle9i RAC (Real Application Clusters).
295998.1 How to solve corruptions on OCFS file system
345081.1 How to Rename a RAC Database in a 10g Real Application Clusters Environment
312051.1 How To Remove Ocfs From Linux Box.
203226.1 : RAC Survival Kit: Real Application Clusters Troubleshooting
289690.1 : Data Gathering for Troubleshooting RAC and CRS issues

********************************************************
471165.1 Additional steps to install 10gR2 RAC on IBM zSeries Based Linux (SLES10)
407086.1 USING CLONING IN CRS/RAC WINDOWS ENVIRONMENTS TO ADD A NODE
414163.1 10gR2 RAC Install issues on Oracle EL5 or RHEL5 or SLES10 (VIPCA Failures)
467753.1 Veritas clusterware 5.0 not recognized by Oracle due to the fact that Veritas
467176.1 RAC: Installing RDBMS Oracle Home Hangs The Oui
466975.1 Step to remove node from Cluster when the node crashes due to OS or H/w
330358.1 CRS 10g R2 Diagnostic Collection Guide
401132.1 How to install Oracle Clusterware with shared storage on block devices
392207.1 CSSD Startup fails with NSerr (12532,12560) transport:(502,0,0) during Install
333166.1 CSSD Startup Fails with NSerr (12546,12560) transport:(516,0,0) During install
330929.1 CRS Stack Fails to Start After Reboot ORA-29702 CRS-0184
463255.1 Enable trace for gsd issues on 10gR2 RAC
338924.1 CLUVFY Fails With Error: Could not find a suitable set of interfaces for VIPs
462616.1 Reconfiguring the CSS disktimeout of 10gR2 Clusterware for Proper LUN Failover
461884.1 How To Disable Fatal Mode Oprocd On HP-UX Itanium 10gR2
404474.1 Status of Certification of Oracle Clusterware with HACMP 5.3 & 5.4
329530.1 Using Redhat Global File System (GFS) as shared storage for RAC
458324.1 Increased 'Log File Sync' waits in 10gR2
341214.1 How To clean up after a Failed (or successful) Oracle Clusterware Installation
454638.1 srvctl command failed - An unexpected exception has been detected in native
276434.1 Modifying the VIP or VIP Hostname of a 10g Oracle Clusterware Node
383123.1 PRKP-1001 CRS-215 srvctl Can not Start 2nd Instance
358620.1 How To Recreate Voting And OCR Disk In 10gR1/2 RAC
200346.1 RAC: Frequently Asked Questions
220970.1 RAC: Frequently Asked Questions
269320.1 Removing a Node from a 10g RAC Cluster
430266.1 How to install 10gR2 and 9iR2 on the same node with different UDLM requirement
283684.1 How to Change Interconnect/Public Interface IP Subnet in a 10g Cluster
391790.1 Unable To Connect To Cluster Manager Ora-29701
294430.1 CSS Timeout Computation in RAC 10g (10g Release 1 and 10g Release 2)
316583.1 VIPCA FAILS COMPLAINING THAT INTERFACE IS NOT PUBLIC
416868.1 CDMP DIRECTORIES AND TRW FILES ON RAC
414177.1 Executing root.sh errors with "Failed To Upg Oracle Cluster Registry Config
390483.1 DRM - Dynamic Resource management
390880.1 OCR Corruption after Adding/Removing voting disk to a cluster when CRS stack
309542.1 How to start/stop the 10g CRS ClusterWare
396643.1 CVU HAS INCORRECT ORA_CRS_HOME VARIABLE AFTER APPLYING CRS BUNDLE II
387205.1 The 10.1.0.4 DB Cannot Start With 10.2.0.2.0 CRS And ASM
270512.1 Adding a Node to a 10g RAC Cluster
395156.1 Startup (mount) of 2nd RAC instance fails with ORA-00600 [kccsbck_first]
363777.1 How to Completely Remove a Service so that its Service_id Can Be Reused
391112.1 Database Resource Manager Spins Lmon To 100% Of Cpu
365530.1 Permissions not set correctly after 10gR2 installation
357808.1 Diagnosability for CRS / EVM / RACG
284752.1 10g RAC: Steps To Increase CSS Misscount, Reboottime and Disktimeout
332180.1 ASMCMD - ASM command line utility
371434.1 Using Openfiler iSCSI with an Oracle database
338047.1 cluvfy ERROR: Unable to retrieve database release version
183408.1 Raw Devices and Cluster Filesystems With Real Application Clusters
367564.1 Server Reboots When Rolling Upgrading CRS(10gr1 -> 10gr2)
358545.1 Root.sh is failing with CORE dumps, during CRS installation
343092.1 How to setup Linux md devices for CRS and ASM
295871.1 How to verify if CRS install is Valid
331934.1 RAC Single Instance (ASM) startup fails with ORA-27300/ORA-27301/ORA-27302
341974.1 10gR2 RAC Scheduling and Process Prioritization
341971.1 10gR2 RAC GES Statistics
341969.1 10gR2 RAC OS Best Practices
341965.1 10gR2 RAC Reference
341963.1 10gR2 RAC Best Practices
313540.1 Manually running cvu to verify stages during a CRS/RAC installation
331168.1 Oracle Clusterware consolidated logging in 10gR2
339710.1 Abnormal Program Termination When Installing 10gR2 on RHAS 4.0
339383.1 CSSD FAILURE DOES NOT REBOOT THE NODE
337937.1 Step By Step - 10gR2 RAC with ASM install on Linux(x86) - Demo
810663.1 11.1.0.X CRS Bundle Patch Information
438049.1 How To Find RDBMS patchsets on My Oracle Support
338706.1 Oracle Clusterware (formerly CRS) Rolling Upgrades
6890831_111070_Linux-x86.zip

********************************************
performance and tunning
********************************************

6890831
842884.1 - How To Understand AWR Report / Statspack Report
744143.1 - Tuning performance on eBusiness suite (section "How to interpret AWR or Statspack report ?")
872733.1 - Transport AWR Data
280209.1 10g RAC Performance Best Practices
810663.1
762526.1 - What do OS stats section of AWR report really tell us? \
884046.1 Understand each field of AWR
153788.1 ORA-600/ORA-7445 Error Look-up Tool [ID ]
https://updates.oracle.com/Orion/QuickLinks/process_form?type=nonapps

CLONING
*********
216664.1 FAQ: Cloning Oracle Applications Release 11i
230672.1 Cloning Oracle Applications Release 11i with Rapid Clone
135792.1 Cloning Oracle Applications Release 11i

Discoverer
************
139516.1 Discoverer 4i with Oracle Applications 11i
257798.1 Discoverer 10g (9.0.4) with Oracle Applications 11i
139516.1 Installation of Discoverer 4i

AutoConfig
************
165195.1 Using AutoConfig to Manage System Configurations with Oracle Applications 11i
218089.1 Autoconfig FAQ

PORTAL
*******
228516.1 How to copy (export/import) Portal database schemas of IAS 9.0.2 to another database
330391.1 How to copy (export/import) Portal database schemas of IAS 10.1.2 to another database

UPGRADES
*********
125767.1 Upgrading Devloper6i with Oracle Applications 11i
216550.1 RDBMS upgrade to 9.2.0
161779.1 Upgradation of HTTP Server
212005.1 Upgrade Oracle Applications to 11.5.8
139863.1 Self Servie Framework Upgrade
112867.1 Express Server & OFA upgrade
124606.1 Jinitiator upgrade
130091.1 JDK upgrade to 1.3
130091.1 Upgrading Oracle Applications 11i to use JDK 1.3
144069.1 Upgrading to Workflow 2.6 with Oracle Applications 11i
159657.1 Complete Upgrade Checklist for Manual Upgrades from 8.X / 9.0.1 to Oracle9i

EXPORT / IMPORT
***************

Note 230627.1 - 9i Export/Import Process for Oracle Applications Release 11i
Note 331221.1 - 10g Export/Import Process for Oracle Applications Release 11i
Note 362205.1 - 10g Release 2 Export/Import Process for Oracle Applications Release 11i
Note 277650.1 - How to Use Export and Import when Transferring DATA Across Platforms or Acros...
Note 243304.1 - 10g: Transportable Tablespaces Across Different Platforms
Note 341733.1 - Export/Import DataPump Parameters INCLUDE and EXCLUDE - How to Load and Unload..
336014.1 - How To Cleanup Orphaned DataPump Jobs In DBA_DATAPUMP_JOBS ?
155477.1 - on improving importing speed

Streams
************
Note 784021.1 Managing Streams from Oracle Enterprise Manager 10g Release 5 Grid Control
Note 460950.1 How To Monitor Oracle Streams Using OEM

create logical standby

Links to this post

TO STOP ARCHIVAL GAP

# Start the standby databases and listeners before starting the primary database.
# Shut down the primary database before shutting down the standby database

* Creation of Logical Standby database (oracle 10gr2)

PRIMARY --> STANDBY

***** Preparing the Primary Database for Standby Database Creation *****

1. Enable Forced Logging

SQL> ALTER DATABASE FORCE LOGGING;

2. Configure a Standby Redo Log

- Ensure log file sizes are identical on the primary and standby databases.
- Determine the appropriate number of standby redo log file groups.
- Verify related database parameters and settings.
- Create standby redo log file groups.
SQL> select MEMBER from v$logfile;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 5
('/oravl04/oradata/PRIMARY/redo_gE_m01.dbf',
'/oravl04/oradata/PRIMARY/redo_gE_m02.dbf') SIZE 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 6
('/oravl04/oradata/PRIMARY/redo_gF_m01.dbf',
'/oravl04/oradata/PRIMARY/redo_gF_m02.dbf') SIZE 50M;

- Verify the standby redo log file groups were created.

SQL> SELECT GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;

3. Set Primary Database Initialization Parameters

#############################################################################################################
# Instance configured as Primary database (Standby STANDBY )
#############################################################################################################


##########################################
# Standby Parameters #
##########################################

DB_UNIQUE_NAME = PRIMARY
LOG_ARCHIVE_CONFIG = 'DG_CONFIG=(PRIMARY,STANDBY)'
LOG_ARCHIVE_DEST_1 = 'LOCATION=/oravl01/oracle/adm/PRIMARY/arc/local_arc VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=PRIMARY'
LOG_ARCHIVE_DEST_2 = 'SERVICE=STANDBY LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=STANDBY'
LOG_ARCHIVE_DEST_STATE_1 = ENABLE
LOG_ARCHIVE_DEST_STATE_2 = ENABLE
REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE
LOG_ARCHIVE_FORMAT = archPRIMARY_%s_%t_%r.dbf
LOG_ARCHIVE_MAX_PROCESSES = 30

Note : Make sure that database is not in Shared server mode.

4. Enable Archiving / create password file / create control file for standby DB (Primary)

SQL> SHUTDOWN IMMEDIATE;
SQL> EXIT

* Create a Password File
orapwd file=$ORACLE_HOME/dbs/orapwPRIMARY PASSWORD=system ENTRIES=10 force=y


SQL> STARTUP MOUNT;
SQL> ALTER DATABASE ARCHIVELOG;

* Create a Control File for Standby Database
QL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/oravl01/oracle/STANDBY.ctl';

SQL> ALTER DATABASE OPEN;


* Check datafiles/logfiles status

SQL> select MEMBER from v$logfile;
SQL> select NAME from v$datafile;
SQL> select NAME from v$tempfile;


***** Step-by-Step Instructions for Creating a Physical Standby Database *****

5. Run Cre_OFA.sh to create OFA for new DB instance.

6. Create a Backup Copy of the Primary Database Datafiles ( Primary )

SQL> alter database begin backup;

<-- Copy All datafiles/redo log files/arch files/cnt file to new DB location -->

SQL> alter database end backup;
-- create new Archive locations

mkdir /oravl99/ORACLE/PRIMARY/arc/local_arc
mkdir /oravl99/ORACLE/PRIMARY/arc/standby_arc


7. Prepare an Initialization Parameter File for the Standby Database

##############################################################################
# Logical standby database instance for PRIMARY (Primary DB instance)
##############################################################################

##########################################
# Standby Parameters #
##########################################

DB_UNIQUE_NAME =STANDBY
LOG_ARCHIVE_CONFIG ='DG_CONFIG=(PRIMARY,STANDBY)'
DB_FILE_NAME_CONVERT ='PRIMARY','STANDBY'
LOG_FILE_NAME_CONVERT ='/oravl04/oradata/PRIMARY/','/oravl04/oradata/STANDBY/'
LOG_ARCHIVE_FORMAT =archPRIMARY_%s_%t_%r.dbf
LOG_ARCHIVE_DEST_1 ='LOCATION=/oravl01/oracle/adm/STANDBY/arc/local_arc VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=STANDBY'
LOG_ARCHIVE_DEST_2 ='SERVICE=PRIMARY LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLES) DB_UNIQUE_NAME=PRIMARY'
LOG_ARCHIVE_DEST_3 ='LOCATION=/oravl01/oracle/adm/STANDBY/arc/standby_arc VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLES) DB_UNIQUE_NAME=STANDBY'
LOG_ARCHIVE_DEST_STATE_1 =ENABLE
LOG_ARCHIVE_DEST_STATE_2 =ENABLE
LOG_ARCHIVE_DEST_STATE_3 =ENABLE

REMOTE_LOGIN_PASSWORDFILE =EXCLUSIVE
STANDBY_FILE_MANAGEMENT = AUTO
FAL_SERVER = PRIMARY
FAL_CLIENT = STANDBY

8. Set Up the Environment to Support the Standby Database
- Create a password file.
orapwd file=$ORACLE_HOME/dbs/orapwSTANDBY PASSWORD=system ENTRIES=10 force=y
- Configure listeners for the primary and standby databases.
% lsnrctl stop
% lsnrctl start


9. Start the Physical Standby Database
set db_name=PRIMARY in init file

SQL> STARTUP MOUNT;

- Rename file location in new Control file (If any)

* Check datafiles/logfiles status

SQL> select MEMBER from v$logfile;
SQL> select NAME from v$datafile;
SQL> select NAME from v$tempfile;
SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=MANUAL;

SQL> ALTER DATABASE RENAME FILE '/oravl04/oradata/STANDBY/system_1.dbf' to '/oravl02/oradata/STANDBY/system_1.dbf';
SQL> ALTER DATABASE RENAME FILE '/oravl04/oradata/STANDBY/undotbs_1.dbf' to '/oravl02/oradata/STANDBY/undotbs_1.dbf';
SQL> ALTER DATABASE RENAME FILE '/oravl04/oradata/STANDBY/sysaux_1.dbf' to '/oravl02/oradata/STANDBY/sysaux_1.dbf';
SQL> ALTER DATABASE RENAME FILE '/oravl04/oradata/STANDBY/users_1.dbf' to '/oravl02/oradata/STANDBY/users_1.dbf';
SQL> ALTER DATABASE RENAME FILE '/oravl04/oradata/STANDBY/pool_data_1.dbf' to '/oravl02/oradata/STANDBY/pool_data_1.dbf';
SQL> ALTER DATABASE RENAME FILE '/oravl04/oradata/STANDBY/pool_ix_1.dbf' to '/oravl02/oradata/STANDBY/pool_ix_1.dbf';
SQL> ALTER DATABASE RENAME FILE '/oravl04/oradata/STANDBY/tools_1.dbf' to '/oravl02/oradata/STANDBY/tools_1.dbf';
SQL> ALTER DATABASE RENAME FILE '/oravl04/oradata/STANDBY/temp_1.dbf' to '/oravl02/oradata/STANDBY/temp_1.dbf';

SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;

- Start Redo Apply, On the standby database, issue the following command to start Redo Apply
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

11. Test archival operations to the physical standby database - run on primary database

SQL> ALTER SYSTEM SWITCH LOGFILE;

12. Verify the Physical Standby Database Is Performing Properly

- Identify the existing archived redo log files. - On the standby database
SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;


- Force a log switch to archive the current online redo log file - On the primary database
SQL> ALTER SYSTEM SWITCH LOGFILE;


* Set ENV time format
SQL> ALTER SESSION set nls_date_FORMAT = 'DD-MON-YY HH:MI:SS';


- Verify the new redo data was archived on the standby database. - On the standby database
SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;


- Verify new archived redo log files were applied. - On the standby database
SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;


*************************************************************************************************************************************************
PHYSICAL STANDBY DATABASE IS READY
*************************************************************************************************************************************************

* Creating a Logical Standby Database


13. Stop Redo Apply on the Physical Standby Database

- To stop Redo Apply, issue the following statement on the physical standby database
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;


14. Prepare the Primary Database to Support a Logical Standby Database


- Prepare the Primary Database for Role Transitions
update init file (include a LOG_ARCHIVE_DEST_3 destination on the primary database)

- Primary
alter system set LOG_ARCHIVE_DEST_3='LOCATION=/oravl01/oracle/adm/PRIMARY/arc/standby_arc VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=PRIMARY';

- Standby

alter system set LOG_ARCHIVE_DEST_3='LOCATION=/oravl01/oracle/adm/STANDBY/arc/standby_arc VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLES) DB_UNIQUE_NAME=STANDBY';

- Primary Init

LOG_ARCHIVE_DEST_3='LOCATION=/oravl01/oracle/adm/PRIMARY/arc/standby_arc VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=PRIMARY'
LOG_ARCHIVE_DEST_STATE_3 = ENABLE

15. Build a Dictionary in the Redo Data - on Primay database

SQL> EXECUTE DBMS_LOGSTDBY.BUILD;


16. Transition to a Logical Standby Database

- Convert to a Logical Standby Database

SQL> ALTER DATABASE RECOVER TO LOGICAL STANDBY STANDBY;

* Note : Got following error which is not the error, you may refer alert log. DB must be renamed using NID utility.

*************************
ERROR at line 1:
ORA-16254: change db_name to STANDBY in the client-side parameter file (pfile)

ORA-16254: change db_name to string in the client-side parameter file (pfile)
Cause: An ALTER DATABASE RECOVER TO LOGICAL STANDBY new-dbname command was successfully executed without a server parameter file (spfile).
Action: The client-side parameter file must be edited so that db_name is set to the given name before mounting the database again
*************************
* Note : if command goes in indefinite mode then then run following command from another session,
(Optional)
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL
18. Adjust Initialization Parameters for the Logical Standby Database

SQL> SHUTDOWN;

- Create a New Password File

orapwd file=$ORACLE_HOME/dbs/orapwSTANDBY_NEW PASSWORD=sys4get ENTRIES=10 force=y

DB_NAME = STANDBY
LOG_ARCHIVE_DEST_1 = 'LOCATION=/oravl01/oracle/adm/STANDBY/arc VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=STANDBY'
LOG_ARCHIVE_DEST_2 = 'SERVICE=PRIMARY LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PRIMARY'
LOG_ARCHIVE_DEST_3 = 'LOCATION=/oravl01/oracle/adm/STANDBY/arc/standby_arc VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=STANDBY'
LOG_ARCHIVE_DEST_STATE_1 = ENABLE
LOG_ARCHIVE_DEST_STATE_2 = ENABLE
LOG_ARCHIVE_DEST_STATE_3 = ENABLE

SQL> STARTUP MOUNT;

19. Open the Logical Standby Database


SQL> ALTER DATABASE OPEN RESETLOGS;


20. Issue the following statement to begin applying redo data to the logical standby database

SQL> ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;

Verify Logical database
SQL> desc dba_logstdby_progress
SQL> select APPLIED_SCN,READ_SCN,NEWEST_SCN from dba_logstdby_progress;

* Optional steps -->


21. Verify the Logical Standby Database Is Performing Properly

- Monitoring Log File Archival Information

a. Determine the status of redo log files.- on primary database

SQL> SELECT THREAD#, SEQUENCE#, ARCHIVED, STATUS FROM V$LOG;

b. Determine the most recent archived redo log file. - on primay database

SQL> SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG GROUP BY THREAD#;

c. Determine the most recent archived redo log file at each destination.- on primary database

SQL> SELECT DESTINATION, STATUS, ARCHIVED_THREAD#, ARCHIVED_SEQ# FROM V$ARCHIVE_DEST_STATUS WHERE STATUS <> 'DEFERRED' AND STATUS <> 'INACTIVE';

d. Find out if archived redo log files have been received. - on primary database
SQL> SELECT LOCAL.THREAD#, LOCAL.SEQUENCE# FROM (SELECT THREAD#, SEQUENCE# FROM V$ARCHIVED_LOG WHERE DEST_ID=1)
LOCAL WHERE LOCAL.SEQUENCE# NOT IN (SELECT SEQUENCE# FROM V$ARCHIVED_LOG WHERE DEST_ID=2 AND THREAD# = LOCAL.THREAD#);


22. Applying Redo Data to Logical Standby Databases


- Starting SQL Apply
SQL> ALTER DATABASE START LOGICAL STANDBY APPLY;


To start redo apply immediate
SQL> ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;


- Stopping SQL Apply on a Logical Standby Database

SQL> ALTER DATABASE STOP LOGICAL STANDBY APPLY;

To stop immediate redo apply
SQL> ALTER DATABASE ABORT LOGICAL STANDBY APPLY;
*************************************************************************************************************************************************
LOGICAL STANDBY DATABASE IS READY
*************************************************************************************************************************************************


select APPLIED_SCN,READ_SCN,NEWEST_SCN from dba_logstdby_progress;

select SEQUENCE#,FIRST_CHANGE#,NEXT_CHANGE#,DICT_BEGIN,DICT_END from DBA_LOGSTDBY_LOG;

select * from DBA_LOGSTDBY_PROGRESS;

Alter database register logical logfile '/oravl99/ORACLE/STANDBY/arc/standby_arc/archSTANDBY_49_1_654631187.dbf';



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


column Archive_dest format a50
column Error format a10

set linesize 100
set pagesize 10000



desc dba_logstdby_log;

*std by

select SEQUENCE#,FIRST_CHANGE#,NEXT_CHANGE# from dba_logstdby_log;

* primary

select SEQUENCE#,FIRST_CHANGE#,NEXT_CHANGE# from v$archived_log;

=================

FORCE LOGGING Option

The database or tablespaces in the database should be put into FORCE LOGGING mode before creating the backup for the standby database. Either a database or all of its tablespaces should be put into this mode but not both.

The following statement will put a tablespace in FORCE LOGGING mode:

ALTER TABLESPACE FORCE LOGGING;

The FORCE LOGGING mode can be cancelled at the database level using the following statement:

ALTER DATABASE NO FORCE LOGGING;

The FORCE LOGGING mode can be cancelled at the tablespace level using the following statement:

ALTER TABLESPACE NO FORCE LOGGING;

Temporary tablespaces and temporary segments have no effect during FORCE LOGGING mode because these objects do not generate any redo. Undo tablespaces are in FORCE LOGGING mode by default, so they cannot be put into FORCE LOGGING mode. Oracle will generate an error if an attempt is made to put a temporary tablespace or undo tablespace into FORCE LOGGING mode.
==========================================
trouble shooting
==========================================

Check the alert logs on both sides.

1. run on primary to detect failures :-

select destination, status, fail_date, valid_now
from v$archive_dest
where dest_name in ('LOG_ARCHIVE_DEST_1','LOG_ARCHIVE_DEST_2','LOG_ARCHIVE_DEST_3','LOG_ARCHIVE_DEST_4')
and (status 'VALID' or VALID_NOW 'YES');

2. run on standby to get exact position of rollforward :-

select thread#, to_char(snapshot_time,'dd-mon-yyyy:hh24:mi'),
to_char(applied_time,'dd-mon-yyyy:hh24:mi'),
to_char(newest_time,'dd-mon-yyyy:hh24:mi') from V$STANDBY_APPLY_SNAPSHOT;

====================================================================================
DATA GUARD
====================================================================================

SYS@dg AS SYSDBA> ALTER SYSTEM SET DG_BROKER_START=TRUE;

System altered.

ON PRIMARY

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/sys
Connected.
DGMGRL> CREATE CONFIGURATION 'FAILOVER' AS PRIMARY DATABASE IS 'BG' CONNECT IDENTIFIER IS 'BG';
Configuration "NAME" created with primary database "DG"
DGMGRL>

DGMGRL> ADD DATABASE 'BG' AS CONNECT IDENTIFIER IS 'BG' MAINTAINED AS PHYSICAL;
Database "BG" added

====================================================================================
SWITCH OVER
====================================================================================
http://www.orafaq.com/node/2078
http://www.fadalti.com/oracle/database/How%20to%20create%20a%20%20logical_standby_database.htm
primary

1)
KILL ALL SESSION;
ALTER SYSTEM SWITCH LOGFILE;
SYS@dg AS SYSDBA> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;

2)ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;

IMMIDEATLY ISSUE ON PRIMARY

3)
SYS@dg AS SYSDBA> shutdown immediate;
SYS@dg AS SYSDBA> startup mount;

4) ON STANDBY AFTER STEP TO 2 COMPLETE

SYS@bg AS SYSDBA> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SYS@bg AS SYSDBA> startup

5)SWITCH LOGFILE ON FORMER STANDBY MEANS CURRENT PRIMARY

ALTERY SYSTEM SWITCH LOGFILE;

6) VARIFY BY

ARCHIVE LOG LIST ON BOTH DATABASES

7) ON FORMER PRIMARY MEANS CURRENT STANDBY

SYS@dg AS SYSDBA> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

----------------------------------references-----------------------------------------------

http://www.orafaq.com/node/2078
http://www.fadalti.com/oracle/database/How%20to%20create%20a%20%20logical_standby_database.htm

RMAN commands.

Links to this post

CREATE USER RMAN IDENTIFIED BY RMAN
DEFAULT TABLESPACE XYX
TEMPORARY TABLESPACE TEMP;

INCREASE TEMP ,UNDO TBS
GRANT RECOVERY_CATALOG_OWNER TO RMAN;

----------------CONFIGURE ARCHIVE MODE----------------
ALTER SYSTEM SET log_archive_start=TRUE SCOPE=spfile;
ALTER SYSTEM SET log_archive_dest_1='location=/u01/oradata/MYSID/archive/' SCOPE=spfile;
ALTER SYSTEM SET log_archive_format='arch_%t_%s.arc' SCOPE=spfile;

===========================================
RMAN
===========================================

-----------ENTER INTO RMAN------------------

Connect to a target database without using a recovery catalog:
% rman TARGET SYS/pwd@target_str

RMAN TARGET / CATALOG RMAN/RMAN@TEST
######connect to both the target database and the recovery catalog:#####
rman TARGET SYS/system@test CATALOG x/x@test
RMAN> CONNECT target sys/oracle@target
CREATE CATALOG;
REGISTER DATABASE;

RMAN> CONNECT TARGET SYS/oracle@trgt
RMAN> CONNECT CATALOG rman/cat@catdb
----connect to target,auxiliary,and recovery catalog databases, launch the RMAN client--------

% rman TARGET SYS/oracle@trgt AUXILIARY SYS/aux@auxdb CATALOG rman/cat@catdb
RMAN> CONNECT AUXILIARY SYS/aux@auxdb

-----------CONFIGURATION----------------------
show all;
CONFIGURE CHANNEL DEVICE TYPE sbt CLEAR;
CONFIGURE RETENTION POLICY CLEAR;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK CLEAR;
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT CLEAR;

The following command configures RMAN to write disk backups to the
/tmp directory:

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/tmp/%U';
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/mybackupdir/cf%F';


------------------RMAN COMMAND--------------------
RMAN> BACKUP ARCHIVELOG COMPLETION TIME BETWEEN
’SYSDATE-31’ AND ’SYSDATE-7’;

RMAN> BACKUP TABLESPACE system, users, tools;
RMAN> BACKUP AS BACKUPSET DATAFILE
’ORACLE_HOME/oradata/trgt/users01.dbf’,
’ORACLE_HOME/oradata/trgt/tools01.dbf’;
RMAN> BACKUP CURRENT CONTROLFILE TO ’/backup/curr_cf.copy’;

RMAN> BACKUP SPFILE;
RMAN> BACKUP BACKUPSET ALL;
RMAN> BACKUP VALIDATE DATABASE ARCHIVELOG ALL;

----------DELETE BACKUP------------------

RMAN> delete noprompt ARCHIVELOG ALL;
RMAN> delete noprompt backup of database;
RMAN> delete noprompt copy of database;
-----------------------DATABASE---------------------

Recovering the Whole Database
Use the RESTORE DATABASE and RECOVER
STARTUP FORCE MOUNT;
run
{
allocate channel c1 type to disk;
RESTORE DATABASE;
RECOVER DATABASE;
ALTER DATABASE OPEN;
}

----------------------TABLESPACE--------------------
Recovering Current Tablespaces
RMAN> SQL 'ALTER TABLESPACE users OFFLINE';
RMAN> RESTORE TABLESPACE users;
RMAN> RECOVER TABLESPACE users;
RMAN> SQL 'ALTER TABLESPACE users ONLINE';

====================================================
---------------------DATAFILE-----------------------\
====================================================

RMAN> SQL 'ALTER DATABASE DATAFILE 7 OFFLINE';
RMAN> RESTORE DATAFILE 7;
RMAN> RECOVER DATAFILE 7;
RMAN> SQL 'ALTER DATABASE DATAFILE 7 ONLINE';

-------USER-MANAGED
SQLPLUS / AS SYSDBA
COPY DATAFILE FROM BACKUP LOCATION
SET NLS_DATE_FORMATE=DD-MON-YYYY HH24:MI:SS
STARTUP MOUNT
RECOVER DATABASE UNTIL TIME ' ';
APPLY THE LOGS
ALTER DATABASE OPEN RESETLOGS;

------------------BLOCK------------------------------
Recovering Individual Data Blocks RMAN can recover individual corrupted
datafile blocks. When RMAN performs a complete scan of a file for a
backup, any corrupted blocks are listed in V$DATABASE_BLOCK_
CORRUPTION. Corruption is usually reported in alert logs, trace files or
results of SQL queries. Use BLOCKRECOVER to repair all corrupted blocks:
RMAN> BLOCKRECOVER CORRUPTION LIST;
You can also recover individual blocks, as shown in this example:
RMAN> BLOCKRECOVER DATAFILE 7 BLOCK 233, 235 DATAFILE 4 BLOCK 101;

-------------------VALIDATE------------------------------
Validating Restores You can run a RESTORE... VALIDATE operation to
confirm that a restore operation can be performed successfully. RMAN
decides which backup sets, datafile copies, and archived logs are needed for
the operation, and scans them to verify that they are usable. For example:
RMAN> RESTORE DATABASE VALIDATE;

----------------------LIST---------------------------
Listing Backups Run the LIST BACKUP and LIST COPY commands to
display information about backups and datafile copies listed in the
repository. You can display specific objects, as in the following examples:

LIST BACKUP; # lists backup sets, image copies, and proxy copies
LIST BACKUPSET; # lists only backup sets and proxy copies
LIST COPY; # lists only disk copies

LIST BACKUP BY FILE; # shows backup sets, proxy copies, and image copies
LIST COPY BY FILE; # shows only disk copies

LIST EXPIRED BACKUP;

LIST EXPIRED BACKUP BY FILE;

LIST BACKUP SUMMARY; # lists backup sets, proxy copies, and disk copies

LIST EXPIRED BACKUP SUMMARY;
RMAN> LIST BACKUP OF DATABASE;
RMAN> LIST COPY OF DATAFILE 1, 2, 3;
RMAN> LIST BACKUP OF ARCHIVELOG FROM SEQUENCE 1437;
RMAN> LIST CONTROLFILECOPY "/tmp/cf.cpy";
RMAN> LIST BACKUPSET OF DATAFILE 1;
For backups, you can control the format of LIST output with these options:
# lists backups of all files in database
LIST BACKUP OF DATABASE;
# lists copy of specified datafile
LIST COPY OF DATAFILE 'ora_home/oradata/trgt/system01.dbf';
# lists specified backup set
LIST BACKUPSET 213;
# lists datafile copy
LIST DATAFILECOPY '/tmp/tools01.dbf';

# specify a backup set by tag
LIST BACKUPSET TAG 'weekly_full_db_backup';
# specify a backup or copy by device type
LIST COPY OF DATAFILE 'ora_home/oradata/trgt/system01.dbf' DEVICE TYPE sbt;
# specify a backup by directory or path
LIST BACKUP LIKE '/tmp/%';
# specify a backup or copy by a range of completion dates
LIST COPY OF DATAFILE 2 COMPLETED BETWEEN '10-DEC-2002' AND '17-DEC-2002';
# specify logs backed up at least twice to tape
LIST ARCHIVELOG ALL BACKED UP 2 TIMES TO DEVICE TYPE sbt;
-------------------------------------------------------------
Parameter Example Explanation
-------------------------------------------------------------
BY BACKUP LIST BACKUP OF BY BACKUP LIST BACKUP OF
For both backups and copies you have the following additional options:
Reporting on Database Files and Backups The REPORT command performsmore
complex analysis than LIST. Some of the main options are:
Monitoring RMAN Through V$ Views Status information for jobs in progress and
completed jobs is stored in V$RMAN_STATUS. V$RMAN_OUTPUT contains
the text ouptut of all RMAN jobs.
BY FILE LIST BACKUP BY FILE Lists the backups according to which
file was backed up.
SUMMARY LIST BACKUP
SUMMARY
Displays reduced output. By default,
the output is VERBOSE.
Parameter Example Explanation
EXPIRED LIST EXPIRED COPY Displays files inaccessible based
on the CROSSCHECK command.
RECOVERABLE LIST BACKUP RECOVERABLE Specifies datafile backups or
copies that are available and that
can be restored and recovered in
the current database incarnation--------

-----------------DELETE INPUT----------------------
With DELETE INPUT,
RMAN only deletes the specific copy of the archived redo log chosen for the backup set.
With DELETE ALL INPUT,
RMAN will delete each backed-up archived redo log file from all log archiving destinations.

For example, assume that you archive to /arc_dest1, /arc_dest2, and /arc_
dest3, and you run the following command:
BACKUP DEVICE TYPE sbt
ARCHIVELOG ALL
DELETE ALL INPUT;
In this case RMAN backs up only one copy of each log sequence number in these
directories, and then deletes all copies of any log that it backed up from the
archiving destinations.
If you had specified DELETE INPUT rather than DELETE ALL INPUT,
then RMAN would only delete the specific archived redo log files that it backed up

================================================
SCENARIO
================================================

----------------------COMPRESS PARALLEL BACKUP--------------------
configure device type disk parallelism 3;
configure default device type to disk;
configure channel 1 device type disk format '/u01/backup/%U';
configure channel 2 device type disk format '/u02/backup/%U';
CONFIGURE CHANNEL 3 DEVICE TYPE DISK FORMAT '/u03/backup/%U';
backup as compressed backupset database plus archivelog;

----------ONLINE BACKUP-------------------------
1. Runs the ALTER SYSTEM ARCHIVE LOG CURRENT command.
2. Runs BACKUP ARCHIVELOG ALL. Note that if backup optimization is enabled,
then RMAN skips logs that it has already backed up to the specified device.
3. Backs up the rest of the files specified in BACKUP command.
4. Runs the ALTER SYSTEM ARCHIVE LOG CURRENT command.
5. Backs up any remaining archived logs generated during the backup.
This guarantees that datafile backups taken during the command are recoverable to
a consistent state.
---------LOST OF CONTROL FILE-------------------
SQLPLUS /NOLOG
SQLPLUS > CONNECT / AS SYSDBA
STARTUP NOMOUNT

RMAN> CONNECT TARGET /
SET DBID
RESTORE CONTROLFILE FROM BACKUP;
ALTER DATABASE MOUNT;
RECOVER DATABASE;
ALTER DATABASE OPEN RESETLOGS;

-------------RECREATE CONTROLFILE------------------

SQLPLUS /NOLOG
CONNECT / AS SYSDBA
ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
EDIT TRACE FILE
COPY PASTE NORESETLOG PART.(TAKE FULL UPTO ALTER DATABASE OPEN)

STARTUP NOMOUNT
RUN COMMAND TO CREATE CONTROLFILE
IF SOMETHING ASKED APPLY LOGS
OR REDO-LOGS ALSO

------USING CANCEL OPTION


SQLPLUS /NOLOG
CONNECT / AS SYSDBA
ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
EDIT TRACE FILE (TAKE UPTO CHARACTERSET OR END OF STATMENT OF CREATE CONTROLFILE)
COPY PASTE RESETLOG PART.*

STARTUP NOMOUNT
RUN COMMAND TO CREATE CONTROLFILE
IF SOMETHING ASKED
CANCEL
ALTER DATABASE OPEN RESETLOGS;

----if backup fails last night--------------
if backup fails
backup database not backed up since time 'sysdate-1';

--------recover deleted records------------------

1 option
INSERT INTO EMPLOYEE_TEMP (SELECT * FROM EMPLOYEE AS OF TIMESTAMP ('13-SEP-04 8:50:58','DD-MON-YY HH24: MI: SS'))
2.option
SQL> select DBMS_FLASHBACK. GET_SYSTEM_CHANGE_NUMBER from dual;
SQL> INSERT INTO EMPLOYEE_TEMP(SELECT * FROM EMPLOYEE AS OF SCN 10280403339);
3.option
SELECT NAME,FIRST_TIME,NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY first_time DESC;
I will chose the appropriate arcive log.

EXECUTE DBMS_LOGMNR.ADD_LOGFILE(logfilename=>'/home/oracle/ARCHIVE_LOG/1_20_650546031.dbf',options=>DBMS_LOGMNR.NEW);
EXECUTE DBMS_LOGMNR.start_logmnr(options=>DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG);

SELECT username,OPERATION,sql_undo,sql_redo
FROM v$logmnr_contents
4.option
conn system/pwd
execute dbms_flashback.enable_at_time(sysdate-10/1440);
select the records now and see 10 minutes old data
execute dbms_flashback.disable;

-------recover table after drop-------------------
FLASHBACK TABLE EMPLOYEE TO BEFORE DROP;

-------recover database to back in time--------------
1.option
SQL> Flashback database to timestamp sysdate-(1/24);
SQL> ALTER DATABASE OPEN RESETLOGS;

------------ restore datafile to different location ------------------------

----------WITH SHUTDOWN DB-----------------------

RMAN> connect target /
RMAN> startup mount;
RMAN> run{
2> set newname for datafile 4 to '/ora01/BRDSTN/data_ts01.dbf';
3> set newname for datafile 5 to '/ora01/BRDSTN/data_ts02.dbf';
4> restore tablespace data_ts;
5> switch datafile all; # Updates repository with new datafile location.
6> recover tablespace data_ts;
7> alter database open;
8> }

place the datafiles offline and then set their new names for restore and recovery:

-------------WITH OPEN DB------------------------------

RMAN> run{
2> sql 'alter database datafile 4, 5 offline';
3> set newname for datafile 4 to '/ora01/BRDSTN/data_ts01.dbf';
4> set newname for datafile 5 to '/ora01/BRDSTN/data_ts02.dbf';
5> restore datafile 4, 5;
5> switch datafile all; # Updates repository with new datafile location.
6> recover datafile 4, 5;
7> sql 'alter database datafile 4, 5 online';
8> }

=====================================================
-------------INCOMPLETE RECOVERY---------------------
=====================================================
----BY TIME

STARTUP MOUNT

SET NLS_DATE_FORMATE=DD-MON-YYYY HH24:MI:SS

....FROM RMAN

RUN
{
SET UNTIL TIME '06-SEP-2010 11:22:20';
RESTORE DATABASE;
RECOVER DATABASE;
}
ALTER DATABASE OPEN RESETLOGS;

----BY REDO

SELECT * FROM V$LOG_HISTORY;
STARTUP MOUNT;

FROM RMAN
RUN
{
SET UNTIL SEQUENCE 3 THREAD 1;
RESTORE DATABASE;
RECOVER DATABASE;
}
ALTER DATABASE OPEN RESETLOGS;

-----------------------------------------------------
KNOWLEDGEBASE
=====================================================

By default, a backup set consists of one backup piece.
For example, you can back up ten datafiles into a single backupset containing a single backup piece

-----------------------WHOLE-------------------------
A WHOLE backup is which is a backup of all datafiles and the current control file
whole database backups with the database mounted or open.To perform a whole database backup

----procedure for taking a whole database backup

RMAN> BACKUP DATABASE; # uses automatic channels to make backup
RMAN> SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT'; # switches logs and archives all
logs
By archiving the logs immediately after the backup, you ensure that you have a full set
of archived logs through the time of the backup. This guarantees that you can perform
media recovery after restoring this backup.
----------------------PARTIAL------------------------

----------------------FULL ---------------------------
A full datafile backup is a backup that includes every used data block in the file.

--------------------INCREMANTEL----------------------
RMAN incremental backups back up only datafile blocks that have changed since a
specified previous backup. You can make incremental backups of databases,
individual tablespaces or datafiles.

Incremental backups are differential by default.

incremental backup can be either of the following types:
________________________________________________________________________________
# A differential backup, which backs up all blocks changed after the most recent
incremental backup at level 1 or 0
________________________________________
level0 level1 level2 level3
1/2/09 1/3/09 1/4/09 1/5/09
-------------------------------------------
*
-------------->
------------>
----------->
BACKUP INCREMENTAL LEVEL 1 DATABASE;
#BACKUP INCREMENTAL LEVEL 0 DATABASE;
#BACKUP INCREMENTAL LEVEL 1
TABLESPACE SYSTEM
DATAFILE 'ora_home/oradata/trgt/tools01.dbf';
________________________________________________________________________________
# A cumulative backup, which backs up all blocks changed after the most recent
incremental backup at level 0
____________________________________________
level0 level1 level2 level3
1/2/09 1/3/09 1/4/09 1/5/09
---------------------------------------------
*
--------------->
---------------------------->
---------------------------------------->

BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;
BACKUP INCREMENTAL LEVEL = 1 CUMULATIVE TABLESPACE users;
____________________________________________________

Incremental backups are differential by default.

You can make incremental backups of databases, individual tablespaces or datafiles.

in ARCHIVELOG mode, you can make incremental backups if the database is open;
in NOARCHIVELOG mode, then you can only make incremental backups when the database is closed.

------------Incrementally Updated Backups: Rolling Forward Image Copy Backups-----------------
At the beginning of a backup strategy, RMAN creates an image copy backup of the datafile.
Then, at regular intervals, such as daily, level 1 incremental backups are taken,
and applied to the image copy backup, rolling it forward to the point in time when the
level 1 incremental was created.

RUN {
RECOVER COPY OF DATABASE WITH TAG 'incr_update'; #apply the increment backup to copy(refresh backup)
BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'incr_update'
DATABASE; (take backup of incremental 1 if its not there it takes the backup from level 1)
}

RUN {
RECOVER COPY OF DATABASE WITH TAG 'incr_update'
UNTIL TIME 'SYSDATE - 7';
BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'incr_update'
DATABASE;
}
# On the first night the RECOVER COPY... UNTIL TIME statement has no effect,
and the BACKUP INCREMENTAL... FOR RECOVER OF COPY statement creates
the incremental level 0 copy.
# On the eighth and all subsequent nights night, the RECOVER COPY... UNTIL
TIME statement applies the level 1 incremental from seven days ago to the copy of
the database. The BACKUP INCREMENTAL... FOR RECOVER OF COPY
statement creates an incremental backup containing the changes for the previous
day

====================================================
RMAN WITH RAC
====================================================
By default, channels will be allocated from one node.
To split the load across all the nodes in the cluster,
individual channels need special configuration.

So in two-node cluster, we can equally distribute the load as
RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 4;

CONFIGURE CHANNEL 1 DEVICE TYPE DISK CONNECT 'sys/passwd@inst1';
CONFIGURE CHANNEL 2 DEVICE TYPE DISK CONNECT 'sys/passwd@inst1';
CONFIGURE CHANNEL 3 DEVICE TYPE DISK CONNECT 'sys/passwd@inst2';
CONFIGURE CHANNEL 4 DEVICE TYPE DISK CONNECT 'sys/passwd@inst2';

Caution: Compressed Backup is CPU bound, so number of channels should be carefully used.

=========================================================================
PARALLELISM
=========================================================================
Note: that if you configure specific channels with numbers higher than the parallelism setting,
RMAN will not use these channels.

In this example, you want to send disk backups to two different disks. Configure disk channels as follows:

CONFIGURE DEFAULT DEVICE TYPE TO disk; # backup goes to disk
CONFIGURE DEVICE TYPE disk PARALLELISM 2; # two channels used in in parallel
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/disk1/%U' # 1st channel to disk1
CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/disk2/%U' # 2nd channel to disk2
BACKUP DATABASE; # backup - first channel goes to disk1 and second to disk2

===========================================================================
QUERY
===========================================================================
SELECT * FROM V$RECOVERY_FILE_DEST; FOR SIZE OF RECOVERY AREA
ALTER SYSTEM SET DB_RECOVERY_FILE_DEST='' SCOPE=BTOTH SID="*";

The following query displays
the number of blocks written to a backup set for each datafile with at least 50% of its
blocks backed up:

SELECT FILE#, INCREMENTAL_LEVEL, COMPLETION_TIME, BLOCKS, DATAFILE_BLOCKS
FROM V$BACKUP_DATAFILE
WHERE INCREMENTAL_LEVEL > 0
AND BLOCKS / DATAFILE_BLOCKS > .5
ORDER BY COMPLETION_TIME;

===============================================
REFERANCE
===============================================
http://www.oracle-base.com/articles/9i/ArchivelogModeOnRAC9i.php ARCHIVE MODE ON RAC

COPY FROM RMAN QUICK START PAGE NO 11 COMMAND LIST


==================================================================
DUPLICATE DATABASE WITH RMAN
==================================================================
1.CREATE PASSWORD FILE FOR DUPLICATE INSTANCE

orapwd file=/u01/app/oracle/product/9.2.0.1.0/dbs/orapwDUP password=password entries=10

2. ADD TNS ENTRIES

# Added to the listener.ora SID_LIST
(SID_DESC =
(ORACLE_HOME = /u01/app/oracle/product/9.2.0.1.0)
(SID_NAME = DUP)
)

# Added to the tnsnames.ora
DUP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = server1.tshcomputing.com)(PORT = 1521))
)
(CONNECT_DATA =
(ORACLE_SID = DUP)
)
)

# Reload listener
lsnrctl reload

3. Next create an init.ora file for the duplicate database. Since we are duplicating the database onto the same server as
the original we must convert the file names so there is no conflict:
# Minimum Requirement.
DB_NAME=DUP
CONTROL_FILES=(/u02/oradata/DUP/control01.ctl,
/u02/oradata/DUP/control02.ctl,
/u02/oradata/DUP/control03.ctl)

# Convert file names to allow for different directory structure.
DB_FILE_NAME_CONVERT=(/u02/oradata/TSH1/,/u02/oradata/DUP/)
LOG_FILE_NAME_CONVERT=(/u01/oradata/TSH1/,/u01/oradata/DUP/)

# make sure block_size and compatible parameters
# match if you are not using the default.
DB_BLOCK_SIZE=8192
COMPATIBLE=9.2.0.0.0

4.Next we connect to the duplicate instance:
ORACLE_SID=DUP; export ORACLE_SID
sqlplus /nolog
conn / as sysdba

5. CREATE SPFILE
CREATE SPFILE FROM PFILE='/u01/app/oracle/admin/DUP/pfile/init.ora';

6.Next we start the database in NOMOUNT mode:
STARTUP FORCE NOMOUNT;
7.With the duplicate database started we can now connect to it from RMAN.
For the duplication to work we must connect to the original database (TARGET),
the recovery catalog (CATALOG) and our duplicate database (AUXILIARY):

ORACLE_SID=DUP; export ORACLE_SID
rman TARGET sys/password@tsh1 CATALOG rman/rman@tshadm AUXILIARY /

8. DUPLICATE DB
# Duplicate database to TARGET's current state.

RUN
{
SET NEWNAME FOR DATAFILE 1 TO /oracle/data/file2.f; # rename datafile 1 as file2.f
SET NEWNAME FOR DATAFILE 2 TO /oracle/data/file1.f; # rename datafile 2 as file1.f
DUPLICATE TARGET DATABASE TO newdb;
}

OR

RUN
{
# set new filenames for the datafiles
SET NEWNAME FOR DATAFILE 1 TO '/dup/oracle/oradata/trgt/system01.dbf';
SET NEWNAME FOR DATAFILE 2 TO '/dup/oracle/oradata/trgt/undotbs01.dbf';
. . .
# issue the duplicate command
DUPLICATE TARGET DATABASE TO dupdb
# create at least two online redo log groups
LOGFILE
GROUP1
(
'/dup/oracle/oradata/trgt/redo01a.log',
'/dup/oracle/oradata/trgt/redo01b.log',
'/dup/oracle/oradata/trgt/redo01c.log';
) SIZE 200K,
GROUP2
(
'/dup/oracle/oradata/trgt/redo02a.log',
'/dup/oracle/oradata/trgt/redo02b.log',
'/dup/oracle/oradata/trgt/redo02c.log';
) SIZE 200K,
GROUP3
(
'/dup/oracle/oradata/trgt/redo03a.log',
'/dup/oracle/oradata/trgt/redo03b.log',
'/dup/oracle/oradata/trgt/redo03c.log';
) SIZE 200K;
}

# Duplicate database to TARGET's state 4 days ago.
DUPLICATE TARGET DATABASE TO DUP UNTIL TIME 'SYSDATE-4';

http://download.oracle.com/docs/cd/B10501_01/server.920/a96566/rcmdupdb.htm#441876
==============================================================
==============================================================

92 from bkp_concept
732 912 1064 bipinbahai
732 912 1499 aka
236 c cinder road edison

Example
——–
Restore RMAN backup from CRM production server on us01ap17 to test server on test_us01ap17

The example assumes:

- the target database is on us01ap17
- the database is to be restored onto test_us01ap17
- the RMAN catalog is installed on us01ap19.
- the directory structure of test_us01ap17 is the same as us01ap17
- the ORACLE_SID will not change for the restored database
- a recovery catalog is being used
- the backups were carried out to disk (for illustrative purposes, and to disassociate from any media manager specific issues)

The following steps are required:

- backup the target on us01ap17
- list the datafile locations on us01ap17
- make the backup available to test_us01ap17
- make a copy of the init.ora available to test_us01ap17
- if directory structure is different, edit the init.ora to reflect directory structure changes
- configure SQL*Net connectivity from host to the recovery catalog and duplicated database
- set up a password file for the duplicated database
- startup nomount the duplicated database
- RMAN restore the controlfile(s)
- mount the database
- restore and rename the datafiles
- recover and open the database

These steps are expanded further below.

1.0 Create Database on test_us01ap17
1.1 Install Oracle database using CD or downloaded files from Oracle
1.2 Ceate Oracle service
oradim -new -sid CRM -intpwd change_on_install -maxusers 20 -startmode auto

1.3 Check to see if password file was created, if not, create using the following command

orapwd file=C:\oracle\ora92\database\PWDCRM.ora password=change_on_install entries=30

1.4 Create spfile

sqlplus /nolog
connect sys/change_on_install@CRM as sysdba
shutdown immediate;
create spfile from pfile=’C:\oracle\admin92\CRM\pfile\initCRM.ora’;
exit;

2.0 Backup the Production database on us01ap17
———————————————-

The target database needs to be backed up using RMAN.
The following is one example of RMAN doing an online database backup. In this example, the backup sets (full hot backup) are written to disk.

First, create a windows batch file, fullbackup.bat

rman catalog rmanager/rmanager@rman target sys/change_on_install@CRM cmdfile=C:\Oracle\job\rman_scripts\rman_full_backup.txt log=C:\Oracle\job\rman_logs\%date:~10,4%_%date:~4,2%_%date:~7,2%_log.txt

Then, create a RMAN script file rman_full_backup.txt

run
{
resync catalog;
allocate channel ch1 device type disk format ‘H:\Rman_backup\%d_%u_%s_%p’;
allocate channel ch2 device type disk format ‘H:\Rman_backup\%d_%u_%s_%p’;
allocate channel ch3 device type disk format ‘H:\Rman_backup\%d_%u_%s_%p’;
#BACKUP INCREMENTAL LEVEL 0 tag = ‘weekly full backup’ database filesperset 1 include current controlfile;
backup incremental level 0 tag = ‘full_hot_backup’ ( database setsize 8192000 filesperset 1 include current controlfile );
sql ‘alter system switch logfile’;
sql ‘alter system archive log current’;
BACKUP filesperset 1 archivelog all delete input;
release channel ch1;
release channel ch2;
release channel ch3;
}

Run the batch script and you will find backup files in H:\Rman_backup

2.1 Export RMAN catalog schema

exp rmanager/rmanager@rman file=P:\Rman\exp\rman_CRM_exp_%date:~0,3%.dmp

this will create an export dump file, e.g., rman_Thu.dmp

2.2 List Datafile Locations on us01ap17
————————————-

If you still have access to us01ap17, meaning it is still running (thank God it is!), you should find out each datafile’s number and location.


SQL> select file#, name from v$datafile;

FILE# NAME
———- ————————————–
1 H:\ORADATA\CRM\SYSTEM01.DBF
2 H:\ORADATA\CRM\UNDOTBS01.DBF
3 H:\ORADATA\CRM\CRM_DATA01.DBF
4 H:\ORADATA\CRM\CRM_DATA02.DBF
5 H:\ORADATA\CRM\CRM_DRSYS01.DBF
6 H:\ORADATA\CRM\CRM_INDX01.DBF
7 H:\ORADATA\CRM\CRM_INDX02.DBF
8 H:\ORADATA\CRM\CRM_TOOLS01.DBF
9 H:\ORADATA\CRM\CRM_USERS01.DBF
10 H:\ORADATA\CRM\CRM_XDB01.DBF
11 H:\ORADATA\I3FP\VERITAS_I3_ORCL.DBF
12 H:\ORADATA\CRM\CRM_DATA03.DBF

The log file names should also be recorded.

SQL> select group#, member from v$logfile;

GROUP# MEMBER
——- ——————————————
1 J:\ORADATA\CRM\REDO01.LOG
2 J:\ORADATA\CRM\REDO02.LOG
3 J:\ORADATA\CRM\REDO03.LOG
4 J:\ORADATA\CRM\CRM_SRL0.F
5 J:\ORADATA\CRM\CRM_SRL1.F

3.0 Make the Backups Available to test_us01ap17
———————————————–

3.1 Disk Backups

During restore, RMAN will expect the backup sets to be located in the same directory as written to during the backup. For disk backups, the DBA can accomplish this in many ways:

- create the same directory structure on us01ap17 and test_us01ap17
- copy RMAN backup files to test_us01ap17
Use Windows explorer to copy RMAN backup files from H:\rman_backup on us01ap17 to test_us01ap17

Also copy RMAN catalog export file to test_us01ap19

4.0 init.ora on test_us01ap17
—————————–

The “init.ora”, e.g., C:\oracle\admin92\CRM\pfile\initCRM.ora needs to be made available on test_us01ap17. Any location specific parameters must be ammended. For example,
- ifile
- *_dump_dest
- log_archive_dest*
- control_files

5.0 SQL*Net configuration
————————-

If running rman from us01ap17:

a. connectivity to the catalog remains unchanged
b. configure tnsnames.ora on us01ap17 to connect to duplicated database on test_us01ap17 configure listener.ora on test_us01ap17 to accept connections for duplicated database

If running rman from test_us01ap17:

a. configure tnsnames.ora on test_us01ap17 to connect to catalog
listener.ora on catalog host remains unchanged

b. configure tnsnames.ora on test_us01ap17 to connect to duplicated db on test_us01ap17 configure listener.ora on test_us01ap17 to accept connections for duplicated database

If running rman from test_us01ap19 (ie, neither us01ap17 or test_us01ap17):

a. connectivity to the catalog remains unchanged
b. configure tnsnames.ora on test_us01ap19 to connect to duplicated db on test_us01ap17
configure listener.ora on test_us01ap17 to accept connections for duplicated database

In this example, RMAN catalog database is installed on test_us01ap19 on test_us01ap17, the tnsnames.ora has the following lines for RMAN


RMAN =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(Host = test_us01ap19)(Port = 1521))
)
(CONNECT_DATA =
(SID = rman)
(SERVER = DEDICATED)
)
)

5.1 Create RMAN catalog schema.
Run this script to create a new RMAN catalog schema

sqlplus /nolog
connect sys/change_on_install@rman as sysdba
rem create tablespace rmancatalog datafile ‘P:\Rman\oradata\rmancatalog.dbf’ size 50m;
drop user rmanunan cascade;
create user rmanunan identified by rman4CRM
temporary tablespace temp
default tablespace rmancatalog
quota unlimited on rmancatalog;
grant recovery_catalog_owner, connect, resource to rmanunan;
exit;

5.2 Import RMAN catalog export into rmanunan schema

imp userid=rmanunan/rman4CRM@rman file=rman_Sun.dmp fromuser=rmanager touser=rmanunan

6.0 Connect to RMAN catalog and check backup

rman catalog rmanunan/rman4CRM@rman target sys/change_on_install@CRM log=C:\Oracle\job\rman_logs\%date:~10,4%_%date:~4,2%_%date:~7,2%_log.txt

6.1 Check available backup with this command

list backup

7.0 Recover Duplicated Database
——————————-

7.1 startup nomount the database using SQLPLUS

SQL> startup nomount pfile=C:\oracle\admin92\CRM\pfile\initCRM.ora

7.2 restore the controlfile(s) (RMAN)

connect to RMAN

run{
allocate channel c1 type disk;
restore controlfile to ‘J:\Oradata\CRM\control04.ctl’;
}

Use OS command, copy J:\Oradata\CRM\control04.ctl to control01.ctl, control02.ctl, control03.ctl

copy J:\Oradata\CRM\control04.ctl J:\Oradata\CRM\control01.ctl
copy J:\Oradata\CRM\control04.ctl J:\Oradata\CRM\control02.ctl
copy J:\Oradata\CRM\control04.ctl J:\Oradata\CRM\control03.ctl

7.2 Mount the database

RMAN> alter database mount;

7.3 rename and restore the datafiles, and perform database recovery

RMAN can be used to change the location of the datafiles from the location on us01ap17 to the new location on test_us01ap17.

Use windows explorer, copy temporary tablespace datafiles to H:\ORADATA\CRM directory. Then run this command

run {
allocate channel c1 type disk;
restore database;
recover database;
}

7.4 restore archive log files (optional)

RMAN> restore archivelog all;

7.5 Recover using SQLPLUS

sqlplus /nolog
SQL>connect sys/change_on_install@CRM as sysdba
SQL>recover automatic database using backup controlfile until cancel;
cancel;
SQL>alter database open resetlogs;
SQL> connect CRM/DBA@CRM;

==================================================================================================
==================================================================================================

/////////////((Creating a Duplicate Database on the Same Host with backup)/////////////////

PROD1 = TARGET
TEST1 = AUXILARY

1. Back up the target database as follows:
2. ADD TEST1 to listener.ora
3. Add TEST1 to tnsnames.ora
4. Create the init.ora file for the new duplicate database, test1.
5. Start the new auxiliary database (duplicate database) instance. in nomount
6. Start RMAN, and connect to the target database ORACLE_SID=prod1.Note that the target database can be mounted or open.
7. Connect to the duplicate database using the keyword auxiliary through a SQL*Net
8. Issue the duplicate target database command to start the database duplication


RMAN> connect target /
RMAN> backup database plus archivelog;

2. Use a dedicated listener configuration for RMAN by making the following additions to
your listener.ora file:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = prod1)
(ORACLE_HOME = /u01/app/oracle/product/11g/)
(SID_NAME =prod1)
)
(SID_DESC =
(GLOBAL_DBNAME = test1)
(ORACLE_HOME = /u01/app/oracle/product/11g/)
(SID_NAME =test1)
)
)
3. Add the following information to the tnsnames.ora file, located in the
$ORACLE_HOME/network/admin directory:
test1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = prod1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test1)
)
)

4. Create the init.ora file for the new duplicate database, test1.

db_name = test1
db_block_size = 8192
compatible = 11.1.0.1.0
remote_login_passwordfile = exclusive
control_files = ('/u01/app/oracle/test1/control01.ctl',
'/u01/app/oracle/test1/control02.ctl')
db_file_name_convert = ('/u01/app/oracle/oradata/prod1',
'/u05/app/oracle/oradata/test1')
log_file_name_convert = ('/u01/app/oracle/oradata/prod1',
'/u05/app/oracle/oradata/test1')

5. Start the new auxiliary database (duplicate database) instance. in nomount

$ export ORACLE_SID=test1
$ sqlplus /nolog
SQL> connect / as sysdba
Connected to an idle instance
SQL> startup nomount pfile=$ORACLE_HOME/dbs/inittest1.ora
Oracle Instance started.
Total System Global Area 113246208 bytes
Fixed Size 1218004 bytes
Variable Size 58722860 bytes
Database Buffers 50331648 bytes
Redo Buffers 2973696 bytes
SQL> exit

6. Start RMAN, and connect to the target database
ORACLE_SID=prod1. Note that the target database can be mounted or open.

$ rman
Recovery Manager: Release 11.1.0.1.0 - Beta on Sat Jun 9 14:03:42 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
RMAN> connect target
connected to target database: prod1 (DBID=2561840016)

7. Connect to the duplicate database using the keyword auxiliary through a SQL*Net
connection:

RMAN> connect auxiliary sys/@test1
connected to auxiliary database: test1 (not mounted)
RMAN>

8. Issue the duplicate target database command to start the database duplication
process:

RMAN> duplicate target database to test1;


==========================================================================================
==========================================================================================

/////////////////Duplicating a Database Without Any RMAN Backups//////////////////////////

1. ADD dedicated listener.ora file:
2. Add tnsnames.ora file
3. CRATE INIT.ORA FILE FROM SPFILE (CHANGE DB_NAME=TEST1)
4. CREATE PASSWORD FILE FOR
5. START THE AUX INSTANCE IN NO MOUNT MODE
6. Start up RMAN, and connect to the target database
7.Connect to the duplicate database auxiliary through a SQL*Net
8. Issue the duplicate target database command to start the database duplication
process:


1. Use a dedicated listener configuration for RMAN by making the following additions to
your listener.ora file:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = prod1)
(ORACLE_HOME = /u01/app/oracle/product/11g/)
(SID_NAME =prod1)
)
(SID_DESC =
(GLOBAL_DBNAME = test1)
(ORACLE_HOME = /u01/app/oracle/product/11g/)
(SID_NAME =test1)
)
)

2. Add tnsnames.ora file,
test1=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = prod1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test1)
)
)

3. CRATE INIT.ORA FILE FROM SPFILE (CHANGE DB_NAME=TEST1)
4. CREATE PASSWORD FILE FOR
5. START THE AUX INSTANCE IN NO MOUNT MODE

$ export ORACLE_SID=test1
$ sqlplus /nolog
SQL> connect / as sysdba

SQL> startup nomount
SQL> exit


6. Start up RMAN, and connect to the target database
$rman target sys/sammyy1@eleven

7.Connect to the duplicate database auxiliary through a SQL*Net

RMAN> connect auxiliary sys/sammyy1@auxdb
connected to auxiliary database: AUXDB (not mounted)

8. Issue the duplicate target database command to start the database duplication
process:
RMAN> duplicate target database
2> to auxdb
3> from active database
4> spfile
5> parameter_value_convert =
'/u01/app/oracle/eleven/eleven','/u01/app/oracle/eleven/auxdb'
6> set log_file_name_convert =
'/u05/app/oracle/eleven/eleven','/u05/app/oracle/eleven/auxdb'
7> db_file_name_convert =
'/u05/app/oracle/eleven/eleven','/u05/app/oracle/eleven/auxdb';

NOTE: DUPLICATE ON DIFF HOST WITH SAME DIRECTORY STRUCTURE , THE METHOD WILL BE SAME UPTO 8 STEP
COMMAND 9 WILL BE DIFFRENT.
RMAN> duplicate database
to newdb
from active database
spfile
nofilenamecheck;

==============================================================================================
==============================================================================================

///////////Creating a Duplicate Database on a Remote Host with the Same File Structure/////////

PRIMARY DB = PROD
DUPLICATE DB = AUX


1. Back up the primary database. You must take a full backup and include all the archive
logs as well as the control file.
2. Create directories, init file for the duplicate database.
3. Start up the auxiliary instance in nomount mode:
4. connect to rman and aux and duplicate db.


1. Back up the primary database. You must take a full backup and include all the archive
logs as well as the control file.


[oracle@linux] rman target=/ catalog rman/rman@catdb
RMAN> run {
allocate channel d1 type disk;
backup format '/backups/PROD/df_t%t_s%s_p%p' database;
backup format '/backups/PROD/al_t%t_s%s_p%p' archivelog all;
release channel d1;
}

2. Create directories, init file for the duplicate database.

audit_file_dest =/oradata/AUX/adump
background_dump_dest =/oradata/AUX/bdump
core_dump_dest =/oradata/AUX/cdump
user_dump_dest =/oradata/AUX/udump
db_name ="AUX"
instance_name =AUX
control_files =('/oradata/AUX/control01.ctl',
'/oradata/AUX/control02.ctl','/oradata/AUX/control03.ctl')
#the following sets the source and target location for data files
db_file_name_convert =("/oradata/PROD/", "/oradata/AUX/")
#the following sets the source and target location for redo log files
log_file_name_convert =("/oradata/PROD/", "/oradata/AUX/")
#the following lines must be the same as those on the target instance
undo_management =AUTO
undo_retention =10800
undo_tablespace =UNDOTBS1
db_block_size = 8192
compatible = 11.1.0.1.0

3. Start up the auxiliary instance in nomount mode:
$ export ORACLE_SID=AUX
$ sqlplus '/as sysdba'
SQL> startup nomount;

4. connect to rman and aux and duplicate db.

$ export ORACLE_SID=AUX
$ rman target sys/sys@PROD catalog rman/rman@catdb auxiliary /
RMAN> duplicate target database to AUX
nofilenamecheck;

NOTE: IF YOU WANT TO DUPLICATE WITH YOU OWN CUSTOM DIRECTORY STRUCTURE

RMAN> run
{set newname for datafile 1 to '/u01/app/oracle/testdata/system01.dbf';
set newname for datafile 2 to '/u01/app/oracle/testdata/sysaux01.dbf';
set newname for datafile 3 to '/u01/app/oracle/testdata/data01.dbf';
set newname for datafile 4 to '/u01/app/oracle/testdata/index01.dbf';
set newname for datafile 5 to '/u01/app/oracle/testdata/undotbs01.dbf';
duplicate target database to newdb
logfile
group 1 ('/u01/app/oracle/testdata/logs/redo01a.log',
('/u01/app/oracle/testdata/logs/redo01b.log') size 10m reuse,
group 2 ('/u01/app/oracle/testdata/logs/redo02a.log',
('/u01/app/oracle/testdata/logs/redo02b.log') size 10m reuse;
}

=====================================================================================
=====================================================================================

/////////////////.Duplicating a Database with Several Directories//////////////////////