Oracle RMAN Backup to the AWS Cloud

Source: Internet
Author: User

The first attempt to back up an Oracle database to the AWS Cloud was typically backed up to a tape library or disk, and now it's easier to have a cloud. This is primarily backed up using AWS's S3 storage as an SBT device. As for what is AWS, what is S3, please refer to: http://www.amazonaws.cn/products/specific steps are as follows:

Prerequisites: You will have an AWS Accunt (AWS access key ID and AWS secret key) and you will need to have Oracle's OTN account and password

1, install CentOS 6.6 64-bit operating system (the specific process slightly)

2. Install Java 1.8 JDK (specific process)

3. Install Oracle 11G Database (Specific process)

4, download the OSB module, can go to http://download.oracle.com/otn/other/osbws_installer.zip find

5, decompression Osbws_installer.zip

[Email protected] ~]$ Unziposbws_installer.zip

. [Email protected] ~]$ Java-jarosbws_install.jar

Oracle Secure Backup Web Service installtool, build 2015-06-22

No arguments supplied

Usage:java-jar Osbws_install.jar

-awsid:aws Access Key ID

-awskey:aws Secret Access Key

-otnuser:otn Username

-walletdir:directory to store Wallet

-configfile:file name of config File

-libdir:directory to store Library

-libplatform:platform of library to download

-location:location to store backups

-proxyhost:http Proxy Host

-proxyport:http Proxy Port

-proxyid:http proxy userid, if needed

-proxypass:http proxy password, if needed

-newlogbucket:force creation of new log buckets

-reregister:force User Registration

When you see the output similar to the above, the downloaded Osbws_install is correct.

6. Edit a script file called: osbws.sh, then enter the following:

Java-jar Osbws_install.jar-awsid xxxxxxxxx \

-awskey//xxxxxxxxx \

-otnuser [email protected] \

-otnpass xxxx \

-walletdir$oracle_home/dbs/osbws_wallet \

-libdir $ORACLE _home/lib/


Explanation:-awsid is an access key ID for AWS For example: ABCDK234DDK39JDL

-awskey is the Secrect key for the acess key ID

-otnuser and-otnpass are your Oracle account password

7. Enter the following command:

[Email protected] ~]$ Mkdir$oracle_home/dbs/osbws_wallet

[Email protected] ~]$ chmod +x osbws.sh

[[email protected] ~]# ntpdate stdtime.gov.hk #切换root用户进行ntp网络时间同步, no sync will error

8, the line osbws.sh

[Email protected] ~]$./osbws.sh
Oracle Secure Backup Web Service Install Tool, build 2015-06-22
AWS credentials is valid.
Re-creating Logbucket
Created new log bucket.
Registration ID:0A43C1D0-2E98-43E2-ACA6-E4B532B408B4
S3 Logging bucket:oracle-log-test-abcx-1
Validating Log Bucket location ...
Validating license File ...
Oracle Secure Backup Web Service Wallet created in Directory/usr/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/osbws_ Wallet.
Oracle Secure Backup Web Service initialization File/usr/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/osbwsorcl.ora Created.
Downloading Oracle Secure Backup Web Service software Library from File Osbws_linux64.zip.
Downloaded 27151475 bytes in 2062 seconds. Transfer rate was 13167 bytes/second.
Download complete.


View $oracle_home/lib Directory

LS $ORACLE _home/lib/*osb*

Output such as:

/usr/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libosbws11.so/usr/oracle/app/oracle/product/11.2.0/dbhome_1 /lib/libosbws.so

The AWS driver has been successfully installed.



Now to test the table space backup and restore operations, I first create a tablespace and a test user, and create a test table under that user. Then back up to AWS with OSB. The process is as follows:

A. CREATE TABLE spaces:

sql> Create Tablespace Up2s3
2 Logging
3 datafile '/usr/oracle/app/oracle/oradata/orcl/up2s3_01.dbf ' SIZE 5M
4 autoextend on;

Tablespace created.

2. Create user

Sql> create user tests3 identified by test;
User created.

Sql>grant Connect,resource to Tests3;

Grant succeeded.

sql> alter user tests3 default Tablespace up2s3;

User altered.
Sql> Conn Tests3/test;
Connected.

Sql> CREATE TABLE Test (ID varchar (20));

Table created.

sql> INSERT into Test (ID) VALUES (' abc ');

1 row created.

Sql> select * from test;

Id
--------------------
Abc

B. Use Rman to back up the up2s3 table space to the cloud and enter it in Rman:

Rman> Run {
2> Allocate channel DEV1 type
3> SBT parms= ' sbt_library=/usr/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libosbws11.so,
4> sbt_parms= (Osb_ws_pfile=/usr/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/osbwsorcl.ora) ';
5> backup tablespace up2s3;
6>}

Output:

Allocated CHANNEL:DEV1
Channel DEV1:SID=32 Device Type=sbt_tape
Channel dev1:oracle Secure Backup Web Services Library

Starting backup at 21-jul-15
Channel dev1:starting full DataFile backup set
Channel dev1:specifying DataFile (s) in backup set
Input datafile file number=00005 name=/usr/oracle/app/oracle/oradata/orcl/up2s3_01.dbf
Channel dev1:starting piece 1 at 21-jul-15
Channel dev1:finished piece 1 at 21-jul-15
Piece handle=01qck3eb_1_1 tag=tag20150721t155035 comment=api version 2.0,mms version 2.0.0.0
Channel Dev1:backup set complete, elapsed time:00:00:25
Finished backup at 21-jul-15
Released Channel:dev1

Now you can try to see your just backup using the list backupset in Rman.

C, delete the Up2s3 table space, simulate the table space damage.

sql> alter tablespace UP2S3 offline;

Tablespace altered.

[email protected] ~]$ Su-
Password:

[Email protected] ~]# mv/usr/oracle/app/oracle/oradata/orcl/up2s3_01.dbf/root/

sql> alter tablespace UP2S3 online;
Alter Tablespace UP2S3 Online
*
ERROR at line 1:
Ora-01157:cannot identify/lock data file 5-see DBWR trace file
Ora-01110:data file 5: '/USR/ORACLE/APP/ORACLE/ORADATA/ORCL/UP2S3_01.DBF '

D, now to recover the Up2s3 table space via Rman

Rman> Run {
2> Allocate channel DEV1 type
3> SBT parms= ' sbt_library=/usr/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libosbws11.so,
4> sbt_parms= (Osb_ws_pfile=/usr/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/osbwsorcl.ora) ';
5> restore Tablespace up2s3;
6> recover tablespace up2s3;
7>}

sql> alter tablespace UP2S3 online;


Tablespace altered.

Sql> Conn Tests3/test
Connected.
Sql> select * from test;

Id
--------------------
Abc


This article is from the "Technical Blog" blog, please be sure to keep this source http://raytech.blog.51cto.com/7602157/1676757

Oracle RMAN Backup to the AWS Cloud

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.