ASM後設資料備份與恢復
1.建立一個表空間
SQL> create tablespace asmtbs datafile '+dg1';
Tablespace created.
SQL> create table t (id number,name varchar2(10)) tablespace asmtbs;
Table created.
SQL> select segment_name,tablespace_name from user_segments where segment_name='T';
SEGMENT_NA TABLESPACE_NAME
---------- ------------------------------
T ASMTBS
3.備份ASM後設資料
[oracle@ocp ~]$ dd if=/dev/oracleasm/disks/VOL1 of=/home/oracle/vol1.bak bs=4096 count=1
1+0 records in
1+0 records out
4.破壞ASM後設資料
[oracle@ocp ~]$ dd if=/dev/zero of=/dev/oracleasm/disks/VOL1 bs=4096 count=1
1+0 records in
1+0 records out
[oracle@ocp ~]$ kfed read /dev/oracleasm/disks/VOL1 --後設資料被破壞
kfbh.endian: 0 ; 0x000: 0x00
kfbh.hard: 0 ; 0x001: 0x00
kfbh.type: 0 ; 0x002: KFBTYP_INVALID
kfbh.datfmt: 0 ; 0x003: 0x00
kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj: 0 ; 0x008: TYPE=0x0 NUMB=0x0
kfbh.check: 0 ; 0x00c: 0x00000000
kfbh.fcn.base: 0 ; 0x010: 0x00000000
kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
kfbh.spare1: 0 ; 0x018: 0x00000000
kfbh.spare2: 0 ; 0x01c: 0x00000000
5.插入資料
SQL> select * from t;
no rows selected
SQL> insert into t values(1,'a');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t;
ID NAME
---------- ------------------------------------------------------------
1 a
6.關閉資料庫例項和ASM例項
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> select status from v$instance;
STATUS
------------
STARTED
SQL> shutdown immediate; --關閉ASM例項
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup --啟動ASM例項
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1217836 bytes
Variable Size 57502420 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted
SQL> alter diskgroup dg1 mount; --掛載磁碟組
alter diskgroup dg1 mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DG1"
7.恢復
[oracle@ocp ~]$ dd if=/home/oracle/vol1.bak of=/dev/oracleasm/disks/VOL1 bs=4096 count=1
1+0 records in
1+0 records out
SQL> alter diskgroup dg1 mount; --磁碟組mount成功
Diskgroup altered.
SQL> startup
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 117442128 bytes
Database Buffers 163577856 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
資料庫也能正常啟動
SQL> create tablespace asmtbs datafile '+dg1';
Tablespace created.
沒有指定大小,預設建立100m.
SQL> select * from v$dbfile;
FILE# NAME
---------- ------------------------------------------------------------
4 /u01/app/oracle/oradata/test/users01.dbf
3 /u01/app/oracle/oradata/test/sysaux01.dbf
2 /u01/app/oracle/oradata/test/undotbs01.dbf
1 /u01/app/oracle/oradata/test/system01.dbf
5 /u01/app/oracle/oradata/test/test01.dbf
6 /u01/app/oracle/oradata/test/mgmt.dbf
7 /u01/app/oracle/oradata/test/mgmt_ecm_depot1.dbf
8 +DG1/test/datafile/asmtbs.256.891217415
8 rows selected.
2.在表空間建立一張表SQL> select * from v$dbfile;
FILE# NAME
---------- ------------------------------------------------------------
4 /u01/app/oracle/oradata/test/users01.dbf
3 /u01/app/oracle/oradata/test/sysaux01.dbf
2 /u01/app/oracle/oradata/test/undotbs01.dbf
1 /u01/app/oracle/oradata/test/system01.dbf
5 /u01/app/oracle/oradata/test/test01.dbf
6 /u01/app/oracle/oradata/test/mgmt.dbf
7 /u01/app/oracle/oradata/test/mgmt_ecm_depot1.dbf
8 +DG1/test/datafile/asmtbs.256.891217415
8 rows selected.
SQL> create table t (id number,name varchar2(10)) tablespace asmtbs;
Table created.
SQL> select segment_name,tablespace_name from user_segments where segment_name='T';
SEGMENT_NA TABLESPACE_NAME
---------- ------------------------------
T ASMTBS
3.備份ASM後設資料
[oracle@ocp ~]$ dd if=/dev/oracleasm/disks/VOL1 of=/home/oracle/vol1.bak bs=4096 count=1
1+0 records in
1+0 records out
4.破壞ASM後設資料
[oracle@ocp ~]$ dd if=/dev/zero of=/dev/oracleasm/disks/VOL1 bs=4096 count=1
1+0 records in
1+0 records out
[oracle@ocp ~]$ kfed read /dev/oracleasm/disks/VOL1 --後設資料被破壞
kfbh.endian: 0 ; 0x000: 0x00
kfbh.hard: 0 ; 0x001: 0x00
kfbh.type: 0 ; 0x002: KFBTYP_INVALID
kfbh.datfmt: 0 ; 0x003: 0x00
kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj: 0 ; 0x008: TYPE=0x0 NUMB=0x0
kfbh.check: 0 ; 0x00c: 0x00000000
kfbh.fcn.base: 0 ; 0x010: 0x00000000
kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
kfbh.spare1: 0 ; 0x018: 0x00000000
kfbh.spare2: 0 ; 0x01c: 0x00000000
5.插入資料
SQL> select * from t;
no rows selected
SQL> insert into t values(1,'a');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t;
ID NAME
---------- ------------------------------------------------------------
1 a
6.關閉資料庫例項和ASM例項
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> select status from v$instance;
STATUS
------------
STARTED
SQL> shutdown immediate; --關閉ASM例項
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup --啟動ASM例項
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1217836 bytes
Variable Size 57502420 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted
SQL> alter diskgroup dg1 mount; --掛載磁碟組
alter diskgroup dg1 mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DG1"
7.恢復
[oracle@ocp ~]$ dd if=/home/oracle/vol1.bak of=/dev/oracleasm/disks/VOL1 bs=4096 count=1
1+0 records in
1+0 records out
SQL> alter diskgroup dg1 mount; --磁碟組mount成功
Diskgroup altered.
SQL> startup
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 117442128 bytes
Database Buffers 163577856 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
資料庫也能正常啟動
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26937943/viewspace-1813431/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 備份與恢復:polardb資料庫備份與恢復資料庫
- Mysql資料備份與恢復MySql
- RabbitMQ如何備份與恢復資料MQ
- postgresql備份與恢復資料庫SQL資料庫
- 資料庫備份與恢復技術資料庫
- RAC備份恢復之Voting備份與恢復
- 資料庫備份恢復資料庫
- 備份與恢復:Polardb資料庫資料基於時間點恢復資料庫
- MySQL-19.資料庫備份與恢復MySql資料庫
- MySQL備份與恢復——基於Xtrabackup物理備份恢復MySql
- Jenkins備份與恢復Jenkins
- Postgresql 備份與恢復SQL
- MySQL 備份與恢復MySql
- Docker Swarm 進階:資料卷備份與恢復DockerSwarm
- Linux下MySQL資料庫的備份與恢復LinuxMySql資料庫
- Mysql備份與恢復(1)---物理備份MySql
- mongodb資料庫備份與恢復(資料庫資料遷移)MongoDB資料庫
- Mysql資料庫備份及恢復MySql資料庫
- 達夢資料庫備份恢復資料庫
- gitlab的資料備份和恢復Gitlab
- 磁碟資料恢復及備份工具資料恢復
- MySQL備份與恢復——基於MyDumper/MyLoader 邏輯備份恢復MySql
- Oracle 備份 與 恢復 概述Oracle
- DB的備份與恢復
- GitLab的備份與恢復Gitlab
- MySQL 非常規恢復與物理備份恢復MySql
- MySQL不同儲存引擎的資料備份與恢復MySql儲存引擎
- Dedecms資料庫恢復與備份的兩種方法資料庫
- 淺談達夢資料庫的備份與恢復資料庫
- Mysql備份與恢復(2)---邏輯備份MySql
- MySQL備份與恢復——基於OUTFILE /LOAD DATA 邏輯備份恢復MySql
- SqlServer資料庫恢復備份資料的方法SQLServer資料庫
- Mongo 資料庫備份和恢復命令Go資料庫
- pg_dump 備份,恢復資料庫資料庫
- 如何恢復Hyper Backup備份的資料
- PostgreSql資料庫的備份和恢復SQL資料庫
- 帝國cms備份和恢復 帝國cms恢復資料
- mysqldump使用方法(MySQL資料庫的備份與恢復)MySql資料庫
- GitLab的自動備份、清理備份與恢復Gitlab