中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Oracle RMAN 備份到AWS 云

發布時間:2020-02-14 11:09:43 來源:網絡 閱讀:2118 作者:raygtr 欄目:關系型數據庫

    首次嘗試將oracle數據庫備份到AWS 云,以前一般都是備份到磁帶庫或者磁盤,現在有了云就更方便了。這里主要是使用AWS 的S3存儲作為SBT設備進行備份。至于什么是AWS,什么是S3,麻煩大家參考:http://www.amazonaws.cn/products/  具體操作步驟如下:

先決條件: 你要有一個AWS accunt(AWS access key ID 與 AWS secret key),你還需要有ORACLE的OTN賬號與密碼

    1、安裝Centos 6.6 64位操作系統(具體過程略)

    2、 安裝JAVA 1.8 JDK (具體過程略)

    3、 安裝 Oracle 11G數據庫 (具體過程略)

    4、下載OSB模塊 ,可以到http://www.oracle.com/technetwork/database/database-technologies/secure-backup/secure-backup-s3-484709.html 查找到

    5、 解壓縮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

當你看見類似上面的輸出,則下載的osbws_install是正確的。

    6、編輯一個腳本文件叫:osbws.sh,然后輸入如下內容:

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/


解釋:-AWSID 是AWS的 access key ID 例如:ABCDK234DDK39JDL

-AWSKey 是該acess key ID 的secrect key

-otnUser 與 -otnPass是你的oracle賬號密碼

    7、輸入下面的命令:

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

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

[root@localhost ~]# ntpdate stdtime.gov.hk   #切換root用戶進行ntp網絡時間同步,不同步會報錯

    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.


查看$ORACLE_HOME/lib目錄

ls $ORACLE_HOME/lib/*osb*

輸出如:

/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

則AWS驅動已經安裝成功。



    現在測試一下表空間備份與還原的操作,我先創建一個表空間以及一個測試用戶,并在該用戶下創建測試表。然后通過OSB備份到AWS上面.具體過程如下:

A、創建表空間:

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、創建用戶

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、利用RMAN把up2s3表空間備份到云端,在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> }

輸出:

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

現在你可以嘗試在rman使用list backupset 看到你剛剛的備份。

C、刪除up2s3表空間,模擬表空間損毀。

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、現在通過RMAN去恢復up2s3表空間

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


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

英超| 澄江县| 兖州市| 普定县| 高密市| 任丘市| 大化| 乾安县| 龙口市| 清苑县| 灵川县| 波密县| 顺平县| 吉水县| 平顶山市| 黄陵县| 沽源县| 四子王旗| 滁州市| 西峡县| 商水县| 岑溪市| 临安市| 通州市| 元江| 咸丰县| 浠水县| 商河县| 沁源县| 弥勒县| 大竹县| 普兰店市| 宣武区| 永昌县| 广州市| 抚顺市| 舟曲县| 津市市| 宁陕县| 苏尼特左旗| 紫阳县|