Showing posts with label RMAN. Show all posts
Showing posts with label RMAN. Show all posts

Friday, October 28, 2011

Oracle Database Cloud Backup to Amazon S3 using osbws

After registering with S3 check to ensure your S3 bucks are available.
I created 2 buckets 1 for the log and 1 for data.
oracle-data--1
oracle-log--1

Ensure your database server can access s3.amazonaws.com
>nslookup s3.amazonaws.com

Non-authoritative answer:
s3.amazonaws.com canonical name = s3-1.amazonaws.com.
Name: s3-1.amazonaws.com
Address: 72.21.203.145

Ensure you have java installed on your database server
java -version
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)

Download osbws_install.jar from otn.oracle.com

Create argFile , I called it awsrman
-AWSID -AWSKEY -otnUser -otnPass < yourOTNpassword> -walletDir /home/oracle/script/wallet -libDir /home/oracle/script -debug

java -jar osbws_install.jar -argFile ./awsrman

Here is the output from the jar install
Oracle Secure Backup Database Web-Service Install Tool, build 2011-02-04.0001
Debug: os.name = Linux
Debug: os.arch = amd64
Debug: os.version = 2.6.18-194.el5
Debug: file.separator = /
Debug: S3 ID:
Debug: S3 Key:
Debug: AWS Success, owner=sthenmoz, id=
AWS credentials are valid.
Debug: Platform = PLATFORM_LINUX64
S3 user already registered.
Registration ID:
S3 Logging Bucket: oracle-log--1
Validating log bucket location ...
Debug: Get location HTTP response: 200 - OK
Debug: log bucket location = []
Validating license file ...
Debug: Get license file HTTP response: 200 - OK
Create credential oracle.security.client.connect_string1
OSB web-services wallet created in directory /home/oracle/script/wallet.
OSB web-services initialization file /opt/oracle/product/10.2.0/db_1/dbs/osbwsTST10G.ora created.
Downloading OSB Web Services Software Library from file osbws_linux64.zip.
Debug: Temp zip file = /tmp/osbws_linux644610275856950839391.zip
Downloaded 16350454 bytes in 10 seconds. Transfer rate was 1635045 bytes/second.
Download complete.
Extracted file /home/oracle/script/libosbws11.so
Debug: Delete RC = true

Created a script to configure rman and placed in configure.rcv
configure CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/home/oracle/script/libosbws11.so ENV=(OSB_WS_PFILE=/opt/oracle/product/10.2.0/db_1
/dbs/osbwsTST10G.ora)';


rman target / @configure.rcv

Output
RMAN> configure CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/home/oracle/script/libosbws11.so ENV=(OSB_WS_PFILE=/opt/oracle/product/10.2.0/db_1/dbs/osbwsTST10G.ora)';
using target database control file instead of recovery catalog
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/home/oracle/script/libosbws11.so ENV=(OSB_WS_PFILE=/opt/oracle/product/10.2.0/db_1/dbs/osbwsTST10G.ora)';
new RMAN configuration parameters are successfully stored

show all;
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/home/oracle/script/libosbws11.so ENV=(OSB_WS_PFILE=/opt/oracle/product/10.2.0/db_1ee/dbs/osbwsTST10G.ora)';



RMAN> backup as compressed backupset database include current controlfile plus archivelog;

Tuesday, October 4, 2011

RMAN Backup Monitoring

A good query to monitor your backups in your rman recovery catalog is.

SELECT db_name, start_time, end_time, status
FROM rcat.rc_rman_backup_job_details
WHERE end_time > sysdate -1

TEST 10/4/2011 12:30:04 AM 10/4/2011 12:32:51 AM COMPLETED
DEV1 10/4/2011 3:05:05 AM 10/4/2011 8:56:13 AM COMPLETED
PROD1 10/3/2011 11:24:07 PM 10/4/2011 9:57:56 AM RUNNING

Thursday, September 29, 2011

RMAN Duplicate 10g

I ran into oracle RMAN bug today and figured it was a good time to add a post on Oracle 10g RMAN duplicates and the work around for the bug I encountered.

The bug is documented on support.oracle.com in Note ID 1076816.1. In short the problem as I was trying to restore up to a sequence time where the sequence had not been recorded in v$log_history or rc_log_history. The work around is to restore to the sequence or a sequence that has been recorded in either v$log_history or rc_log_history.

For an overview of my duplicate procedure.

There is a good note on support.oracle.com for rac database duplicate to asm.
RMAN Duplicate Database From RAC ASM To RAC ASM [ID 461479.1]

I create spfile from pfile and mount and edited pfile on my target server. I then add a tns entry for the database I am cloning on the server where my clone is going to be hosted to allow me to communicate with the target database.

I then create an rman script setting the new names of the files where I am placing them since I am restoring to a different asm disk group than target database uses. This sql script is helpful to set the names for the restored data files.

select 'set newname for datafile ' || file_id || ' to ''+DATA/test/' ||
substr(file_name,instr(file_name,'/',-1)+1) || ''';'
from dba_data_files


set newname for datafile 1 to '+DATA/test/system.311.750536617';
set newname for datafile 3 to '+DATA/test/sysaux.342.750535475';

Here is the sql script to get my max sequence# to restore to.

select max(sequence#) from v$log_history where thread# =1;

Here is what my clone rman rcv script looks like.

run
{
set until sequence 2727 thread 1;
set newname for datafile 1 to '+DATA/test/system.311.750536617';
set newname for datafile 3 to '+DATA/test/sysaux.342.750535475';
... set newnames ...
DUPLICATE TARGET DATABASE TO test;
restore database;
SWITCH DATAFILE ALL;
recover database;
}


Now to run the duplicate, connect to rman on server hosting cloned database.

rman target sys@mytargetdb auxiliary / catalog rmancat/rmancatpwd@emrep
@duplicate.rcv