Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle RMAN backup to AWS Cloud

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The first attempt to back up an oracle database to the AWS cloud used to be to a tape library or disk, but now it is more convenient to have a cloud. The main purpose here is to use AWS's S3 storage as a SBT device for backup. As for what is AWS and what is S3, please refer to: the specific operation steps of http://www.amazonaws.cn/products/ are as follows:

Prerequisites: you need to have an AWS accunt (AWS access key ID and AWS secret key), and you also need to have an OTN account and password for ORACLE

1. Install Centos 6.6 64-bit operating system (the specific process is brief)

2. Install JAVA 1.8 JDK (the specific process is brief)

3. Install Oracle 11G database (the specific process is brief)

4. Download the OSB module, and you can find it in http://www.oracle.com/technetwork/database/database-technologies/secure-backup/secure-backup-s3-484709.html

5. Decompress osbws_installer.zip

[oracle@localhost ~] $unzip osbws_installer.zip

. [oracle@localhost ~] $java-jar osbws_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 bucket

-reRegister: Force user registration

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

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

Java-jar osbws_install.jar-AWSID XXXXXXXXX\

-AWSKey / / XXXXXXXXX\

-otnUser XXXX@ABC.COM\

-otnPass xxxx\

-walletDir$ORACLE_HOME/dbs/osbws_wallet\

-libDir $ORACLE_HOME/lib/

Explanation:-AWSID is the access key ID of AWS for example: ABCDK234DDK39JDL

-AWSKey is the secrect key of the acess key ID

-otnUser and-otnPass are your oracle account passwords.

7. Enter the following command:

[oracle@localhost ~] $mkdir $ORACLE_HOME/dbs/osbws_wallet

[oracle@localhost ~] $chmod + x osbws.sh

[root@localhost ~] # ntpdate stdtime.gov.hk # switch root users for ntp network time synchronization. An error will be reported if not synchronized.

8. Osbws.sh

[oracle@localhost] $. / osbws.sh

Oracle Secure Backup Web Service Install Tool, build 2015-06-22

AWS credentials are 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 the $ORACLE_HOME/lib directory

Ls $ORACLE_HOME/lib/*osb*

The output is like:

/ 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

Then the AWS driver has been installed successfully.

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

A. create tablespaces:

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 a 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 tablespace to the cloud, and type 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 using list backupset in rman to see the backup you just made.

C. Delete up2s3 tablespace and simulate tablespace damage.

SQL > alter tablespace up2s3 offline

Tablespace altered.

[oracle@localhost ~] $su-

Password:

[root@localhost ~] # 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 restore up2s3 tablespaces through 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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report