标签云
asm恢复 bbed bootstrap$ dul In Memory kcbzib_kcrsds_1 kccpb_sanity_check_2 MySQL恢复 ORA-00312 ORA-00607 ORA-00704 ORA-00742 ORA-01110 ORA-01555 ORA-01578 ORA-01595 ORA-08103 ORA-600 2131 ORA-600 2662 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 Oracle 恢复 ORACLE恢复 ORACLE数据库恢复 oracle 比特币 OSD-04016 YOUR FILES ARE ENCRYPTED 勒索恢复 比特币加密文章分类
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (103)
- 数据库 (1,767)
- DB2 (22)
- MySQL (77)
- Oracle (1,608)
- Data Guard (52)
- EXADATA (8)
- GoldenGate (24)
- ORA-xxxxx (166)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (15)
- ORACLE 21C (3)
- Oracle 23ai (8)
- Oracle ASM (69)
- Oracle Bug (8)
- Oracle RAC (54)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (29)
- Oracle备份恢复 (590)
- Oracle安装升级 (97)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (86)
- PostgreSQL (30)
- pdu工具 (6)
- PostgreSQL恢复 (9)
- SQL Server (32)
- SQL Server恢复 (13)
- TimesTen (7)
- 达梦数据库 (3)
- 达梦恢复 (1)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (39)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (22)
-
最近发表
- ORA-00756 ORA-10567故障数据0丢失恢复
- 数据库文件变成32k故障恢复
- tcp连接过多导致监听TNS-12532 TNS-12560 TNS-00502错误
- 文件系统格式化MySQL数据库恢复
- .sstop勒索加密数据库恢复
- 解决一次硬件恢复之后数据文件0kb的故障恢复case
- Error in invoking target ‘libasmclntsh19.ohso libasmperl19.ohso client_sharedlib’问题处理
- ORA-01171: datafile N going offline due to error advancing checkpoint
- linux环境oracle数据库被文件系统勒索加密为.babyk扩展名溯源
- ORA-600 ksvworkmsgalloc: bad reaper
- ORA-600 krccfl_chunk故障处理
- Oracle Recovery Tools恢复案例总结—202505
- ORA-600 kddummy_blkchk 数据库循环重启
- 记录一次asm disk加入到vg通过恢复直接open库的案例
- CHECKDB 发现了 N 个分配错误和 M 个一致性错误
- 达梦数据库dm.ctl文件异常恢复
- Oracle Recovery Tools修复ORA-00742、ORA-600 ktbair2: illegal inheritance故障
- 可能是 tempdb 空间用尽或某个系统表不一致故障处理
- 11.2.0.4库中遇到ORA-600 kcratr_nab_less_than_odr报错
- [MY-013183] [InnoDB] Assertion failure故障处理
分类目录归档:Oracle ASM
找回ASM中数据文件
很多时候由于asm不能正常启动,导致数据丢失。下面提供两种方法找回asm中的数据文件
一.使用AMDU工具
AMDU是Oracle 11g里自带的一个免费的工具,用于分析ASM磁盘组的元数据以及从不能mount的磁盘组中往外抽取数据文件“NOTE:553639.1 Placeholder for AMDU binaries and using with ASM 10g”明确指出:AMDU也可用于10g,并提供了可用于10g的AMDU的各个操作系统的版本供大家下载。
1.设置LD_LIBRARY_PATH
rac1-> export LD_LIBRARY_PATH=/tmp/amdu
2.查看asm磁盘信息
rac1-> ./amdu -diskstring '/dev/raw/raw*' amdu_2012_03_05_03_17_19/ rac1-> cd amdu_2012_03_05_03_17_19/ rac1-> ls report.txt rac1-> more report.txt -*-amdu-*- ******************************* AMDU Settings ******************************** ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1 System name: Linux Node name: rac1 Release: 2.6.9-89.0.0.0.1.ELhugemem Version: #1 SMP Tue May 19 04:38:38 EDT 2009 Machine: i686 amdu run: 05-MAR-12 03:17:19 Endianess: 1 --------------------------------- Operations --------------------------------- ------------------------------- Disk Selection ------------------------------- -diskstring '/dev/raw/raw*' ------------------------------ Reading Control ------------------------------- ------------------------------- Output Control ------------------------------- ********************************* DISCOVERY ********************************** ----------------------------- DISK REPORT N0001 ------------------------------ Disk Path: /dev/raw/raw23 Unique Disk ID: Disk Label: Physical Sector Size: 512 bytes Disk Size: 156 megabytes ** NOT A VALID ASM DISK HEADER. BAD VALUE IN FIELD blksize_kfdhdb ** ----------------------------- DISK REPORT N0002 ------------------------------ Disk Path: /dev/raw/raw11 Unique Disk ID: Disk Label: Physical Sector Size: 512 bytes Disk Size: 156 megabytes ** NOT A VALID ASM DISK HEADER. BAD VALUE IN FIELD blksize_kfdhdb ** ----------------------------- DISK REPORT N0003 ------------------------------ Disk Path: /dev/raw/raw32 Unique Disk ID: Disk Label: Physical Sector Size: 512 bytes Disk Size: 156 megabytes ** NOT A VALID ASM DISK HEADER. BAD VALUE IN FIELD blksize_kfdhdb ** ----------------------------- DISK REPORT N0004 ------------------------------ Disk Path: /dev/raw/raw31 Unique Disk ID: Disk Label: Physical Sector Size: 512 bytes Disk Size: 156 megabytes ** NOT A VALID ASM DISK HEADER. BAD VALUE IN FIELD blksize_kfdhdb ** ----------------------------- DISK REPORT N0005 ------------------------------ Disk Path: /dev/raw/raw12 Unique Disk ID: Disk Label: Physical Sector Size: 512 bytes Disk Size: 156 megabytes ** NOT A VALID ASM DISK HEADER. BAD VALUE IN FIELD blksize_kfdhdb ** ----------------------------- DISK REPORT N0006 ------------------------------ Disk Path: /dev/raw/raw2 Unique Disk ID: Disk Label: Physical Sector Size: 512 bytes Disk Size: 1976 megabytes Group Name: DATA Disk Name: DATA_0001 Failure Group Name: DATA_0001 Disk Number: 1 Header Status: 3 Disk Creation Time: 2012/03/01 22:32:39.289000 Last Mount Time: 2012/03/05 02:10:02.771000 Compatibility Version: 0x0a100000 Disk Sector Size: 512 bytes Disk size in AUs: 1976 AUs Group Redundancy: 1 Metadata Block Size: 4096 bytes AU Size: 1048576 bytes Stride: 113792 AUs Group Creation Time: 2012/03/01 22:32:39.221000 File 1 Block 1 location: AU 0 ----------------------------- DISK REPORT N0007 ------------------------------ Disk Path: /dev/raw/raw1 Unique Disk ID: Disk Label: Physical Sector Size: 512 bytes Disk Size: 3137 megabytes Group Name: DATA Disk Name: DATA_0000 Failure Group Name: DATA_0000 Disk Number: 0 Header Status: 3 Disk Creation Time: 2012/03/01 22:32:39.289000 Last Mount Time: 2012/03/05 02:10:02.771000 Compatibility Version: 0x0a100000 Disk Sector Size: 512 bytes Disk size in AUs: 3137 AUs Group Redundancy: 1 Metadata Block Size: 4096 bytes AU Size: 1048576 bytes Stride: 113792 AUs Group Creation Time: 2012/03/01 22:32:39.221000 File 1 Block 1 location: AU 2 ******************************* END OF REPORT ********************************
从这里可以得到信息如下:
1)只有/dev/raw/raw1和raw2是有效的asm磁盘
2)磁盘组只有DATA
3.找出数据文件信息
rac1-> ../amdu -diskstring '/dev/raw/raw*' -dump 'DATA' amdu_2012_03_05_03_19_38/ rac1-> cd amdu_2012_03_05_03_19_38/ rac1-> ls DATA_0001.img DATA.map report.txt rac1-> strings DATA_0001.img |grep DATAFILE DATAFILE DATAFILE DATAFILE DEVDB/DATAFILE/SYSTEM.256.776817753 DEVDB/DATAFILE/SYSAUX.257.776817753 DEVDB/DATAFILE/UNDOTBS1.258.776817753 DEVDB/DATAFILE/USERS.259.776817753 DEVDB/DATAFILE/UNDOTBS2.267.776817909
从这里可以得出数据文件的file号(第一位数字)
4.恢复数据文件
rac1-> ../../amdu -diskstring '/dev/raw/raw*' -extract 'DATA.259' amdu_2012_03_05_03_27_21/ rac1-> cd amdu_2012_03_05_03_27_21/ rac1-> ls -l total 5148 -rw-r--r-- 1 oracle oinstall 5251072 Mar 5 03:27 DATA_259.f -rw-r--r-- 1 oracle oinstall 6468 Mar 5 03:27 report.txt rac1-> dbv file=DATA_259.f DBVERIFY: Release 10.2.0.1.0 - Production on Mon Mar 5 03:28:00 2012 Copyright (c) 1982, 2005, Oracle. All rights reserved. DBVERIFY - Verification starting : FILE = DATA_259.f DBVERIFY - Verification complete Total Pages Examined : 640 Total Pages Processed (Data) : 15 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 2 Total Pages Failing (Index): 0 Total Pages Processed (Other): 26 Total Pages Processed (Seg) : 0 Total Pages Failing (Seg) : 0 Total Pages Empty : 597 Total Pages Marked Corrupt : 0 Total Pages Influx : 0 Highest block SCN : 442362 (0.442362)
二.使用aulasm工具
1.配置ASM使用磁盘
[root@rac1 oracle]# more disk /dev/sdb1 /dev/sdb2
2.使用aulasm
[root@rac1 oracle]# ./aulasm_linux32_trial.bin AUL : AnySQL UnLoader(MyDUL) for Oracle ASM, release 2.0.0 (C) Copyright Lou Fangxin 2011-2012 (AnySQL.net), all rights reserved. ASM> help SET -- set options (BLOCK_SIZE, AU_SIZE, F1B1_DISK, F1B1_AU) OPEN -- open data file ADD -- add disk with customized disk num (disk, path) LIST -- list opened disks information (to) LSAU -- list file of given AU (disk, au, count) FILE -- list all file entries in ASM (file, [disk, au, block]). ALIAS -- list all alias entries in ASM (file, [disk, au, block]). EXTENT -- list or adjust variable extent (level, au, count). FMAP -- list file extent (file, [disk, au, block], to) DUMP -- dump file extent (file, [disk, au, block], offset, to) COPY -- copy file to os (file, [disk, au, block], to) QUIT/EXIT -- exit the program. ASM> open disk 2012-03-05 03:32:48 2012-03-05 03:32:48 ASM> list 2012-03-05 03:32:49 Total Disks = 2, ausize=1048576, blksize=4096 disk size block disk name disk group disk path ===== ======== ===== ================ ============ ======================== 0 3137 4096 DATA_0000 DATA /dev/sdb1 1 1976 4096 DATA_0001 DATA /dev/sdb2 f1b1disk = 0, f1b1au = 2, score=256, compat=0x0a100000 file=(1,0,2,1), disk=(2,0,2,2), alias=(6,0,2,6) 2012-03-05 03:32:49 ASM> alias 2012-03-05 03:33:15 file inc parent fstblk flag refer alias ======== ============ ====== ====== ==== ====== ========================== -1 -1 0 0 4 1 DEVDB -1 -1 0 1 4 2 DATAFILE -1 -1 0 1 4 3 CONTROLFILE -1 -1 0 1 4 4 ONLINELOG -1 -1 0 1 4 5 TEMPFILE -1 -1 0 1 4 6 PARAMETERFILE -1 -1 0 1 4 7 ARCHIVELOG 256 776817753 1 2 18 -1 SYSTEM 257 776817753 1 2 18 -1 SYSAUX 258 776817753 1 2 18 -1 UNDOTBS1 259 776817753 1 2 18 -1 USERS 267 776817909 1 2 18 -1 UNDOTBS2 261 776817829 1 3 18 -1 Current 260 776817829 1 3 18 -1 Current 262 776817833 1 4 18 -1 group_1 263 776817835 1 4 18 -1 group_1 264 776817837 1 4 18 -1 group_2 265 776817841 1 4 18 -1 group_2 268 776818011 1 4 18 -1 group_3 269 776818013 1 4 18 -1 group_3 270 776818015 1 4 18 -1 group_4 271 776818017 1 4 18 -1 group_4 266 776817859 1 5 18 -1 TEMP 272 776818021 1 6 18 -1 spfile -1 -1 1 7 4 8 2012_03_01 -1 -1 1 7 4 9 2012_03_03 -1 -1 1 7 4 10 2012_03_05 273 776818747 7 8 18 -1 thread_1_seq_2 274 776819571 7 8 18 -1 thread_1_seq_3 275 776819721 7 8 18 -1 thread_2_seq_1 276 776820331 7 8 18 -1 thread_1_seq_4 277 776992321 7 9 18 -1 thread_1_seq_5 278 776992321 7 9 18 -1 thread_2_seq_2 279 777089437 7 10 18 -1 thread_1_seq_6 2012-03-05 03:33:15 ASM> fmap file 259 2012-03-05 03:34:49 fid=259, disk=0, au=56, block=3 siz=5, ecnt=6, eeof=6, flags=17, type=12, alias=109,-1 extid disk auid cnt flg chk ========== ===== ========== ==== === === 1 0 428 1 0 135 2 1 408 1 0 178 3 0 429 1 0 134 4 1 409 1 0 179 5 0 430 1 0 133 6 1 410 1 0 176 2012-03-05 03:34:49 ASM> copy file 259 to user_259 2012-03-05 03:35:01 2012-03-05 03:35:01 [root@rac1 oracle]# ll total 6252 -rwxr-xr-x 1 root root 84619 Mar 6 2012 aulasm_linux32_trial.bin -rw-r--r-- 1 root root 20 Mar 5 02:52 disk -rw-r--r-- 1 root root 6291456 Mar 5 03:35 user_259 [root@rac1 oracle]# su - oracle rac1-> dbv file=user_259 DBVERIFY: Release 10.2.0.1.0 - Production on Mon Mar 5 03:35:27 2012 Copyright (c) 1982, 2005, Oracle. All rights reserved. DBVERIFY - Verification starting : FILE = user_259 DBVERIFY - Verification complete Total Pages Examined : 640 Total Pages Processed (Data) : 15 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 2 Total Pages Failing (Index): 0 Total Pages Processed (Other): 26 Total Pages Processed (Seg) : 0 Total Pages Failing (Seg) : 0 Total Pages Empty : 597 Total Pages Marked Corrupt : 0 Total Pages Influx : 0 Highest block SCN : 442362 (0.442362)
通过dbv验证,两个数据文件(文件大小有出入,可能在对待未格式化数据块上,两者处理有出入)可以基本上确定一致,证明两种方法都可以从异常的ASM中获取数据文件
三.总结与比较
1.AMDU完全免费,aulasm超过16块硬盘需要收费
2.AMDU操作相对于aulasm麻烦一点,但是整体还是可以接受
3.获取到asm中的数据文件后恢复数据内容或者open库,那都是容易的事情
如果因为磁盘头损坏太多或者其他原因,以上方法都不能实现抽取asm磁盘组中数据文件,参考:asm disk header 彻底损坏恢复
远程访问ASM
一、动态监听
1.监听文件
[oracle@node1 admin]$ more /u01/oracle/network/admin/listener.ora SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u01/oracle) (PROGRAM = extproc) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = node1)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0)) ) )
2.监听状态
[oracle@node1 admin]$ lsnrctl status LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 18-JAN-2012 13:38:42 Copyright (c) 1991, 2007, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=node1)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production Start Date 18-JAN-2012 13:32:49 Uptime 0 days 0 hr. 5 min. 53 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/oracle/network/admin/listener.ora Listener Log File /u01/oracle/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=node1)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0))) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM", status BLOCKED, has 1 handler(s) for this service... Service "+ASM_XPT" has 1 instance(s). Instance "+ASM", status BLOCKED, has 1 handler(s) for this service... Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service... Service "chf" has 1 instance(s). Instance "chf", status READY, has 1 handler(s) for this service... Service "chfXDB" has 1 instance(s). Instance "chf", status READY, has 1 handler(s) for this service... Service "chf_XPT" has 1 instance(s). Instance "chf", status READY, has 1 handler(s) for this service... The command completed successfully
3.客户端tns文件[有部分测试加上了(UR=A)]
vm_asm = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM) (UR=A) #分存在和不存在测试 ) ) vm_chf = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = chf) (INSTANCE_NAME = chf) ) )
4.无测试(UR=A)
C:\Users\XIFENFEI>tnsping vm_asm TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 23-2月 - 2012 22:15:10 Copyright (c) 1997, 2010, Oracle. All rights reserved. 已使用的参数文件: e:\oracle\11_2_0\network\admin\sqlnet.ora 已使用 TNSNAMES 适配器来解析别名 尝试连接 (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM))) OK (10 毫秒) C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@vm_asm as sysdba SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 22:15:14 2012 Copyright (c) 1982, 2010, Oracle. All rights reserved. ERROR: ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务 请输入用户名: ERROR: ORA-12560: TNS: 协议适配器错误 请输入用户名: ERROR: ORA-12560: TNS: 协议适配器错误 SP2-0157: 在 3 次尝试之后无法连接到 ORACLE, 退出 SQL*Plus --通过下面的数据库实例测试,证明动态监听是正常工作的,可以访问数据库 C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@vm_chf as sysdba SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 21:55:03 2012 Copyright (c) 1982, 2010, Oracle. All rights reserved. 连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select instance_name from v$instance; INSTANCE_NAME ---------------- chf
5.含(UR=A)测试
C:\Users\XIFENFEI>tnsping vm_asm TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 23-2月 - 2012 22:16:49 Copyright (c) 1997, 2010, Oracle. All rights reserved. 已使用的参数文件: e:\oracle\11_2_0\network\admin\sqlnet.ora 已使用 TNSNAMES 适配器来解析别名 尝试连接 (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM) (UR=A))) OK (20 毫秒) C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@vm_asm as sysdba SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 22:16:52 2012 Copyright (c) 1982, 2010, Oracle. All rights reserved. 连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select instance_name from v$instance; INSTANCE_NAME -------------------------------- +ASM
二、静态监听
1.监听文件
[oracle@node1 admin]$ more listener.ora SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = chf) (ORACLE_HOME = /u01/oracle) (SID_NAME = chf) ) (SID_DESC = (GLOBAL_DBNAME = +ASM) (ORACLE_HOME = /u01/oracle) (SID_NAME = +ASM) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT = 1521)) ) )
2.监听状态
[oracle@node1 admin]$ lsnrctl status LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 18-JAN-2012 13:53:52 Copyright (c) 1991, 2007, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.30)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production Start Date 18-JAN-2012 13:51:48 Uptime 0 days 0 hr. 2 min. 4 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/oracle/network/admin/listener.ora Listener Log File /u01/oracle/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.30)(PORT=1521))) Services Summary... Service "+ASM" has 2 instance(s). Instance "+ASM", status UNKNOWN, has 1 handler(s) for this service... Instance "+ASM", status BLOCKED, has 1 handler(s) for this service... Service "+ASM_XPT" has 1 instance(s). Instance "+ASM", status BLOCKED, has 1 handler(s) for this service... Service "chf" has 2 instance(s). Instance "chf", status UNKNOWN, has 1 handler(s) for this service... Instance "chf", status READY, has 1 handler(s) for this service... Service "chfXDB" has 1 instance(s). Instance "chf", status READY, has 1 handler(s) for this service... Service "chf_XPT" has 1 instance(s). Instance "chf", status READY, has 1 handler(s) for this service... The command completed successfully
3.无(UR=A)测试
C:\Users\XIFENFEI>tnsping vm_asm TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 23-2月 - 2012 22:11:34 Copyright (c) 1997, 2010, Oracle. All rights reserved. 已使用的参数文件: e:\oracle\11_2_0\network\admin\sqlnet.ora 已使用 TNSNAMES 适配器来解析别名 尝试连接 (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM))) OK (20 毫秒) C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@vm_asm as sysdba SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 22:11:06 2012 Copyright (c) 1982, 2010, Oracle. All rights reserved. 连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select instance_name from v$instance; INSTANCE_NAME -------------------------------- +ASM
4.含(UR=A)测试
C:\Users\XIFENFEI>tnsping vm_asm TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 23-2月 - 2012 22:12:49 Copyright (c) 1997, 2010, Oracle. All rights reserved. 已使用的参数文件: e:\oracle\11_2_0\network\admin\sqlnet.ora 已使用 TNSNAMES 适配器来解析别名 尝试连接 (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM) (UR=A))) OK (10 毫秒) C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@vm_asm as sysdba SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 22:12:53 2012 Copyright (c) 1982, 2010, Oracle. All rights reserved. 连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select instance_name from v$instance; INSTANCE_NAME -------------------------------- +ASM
5.easy connect访问asm实例
C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@192.168.1.30/+asm as sysdba SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 22:27:42 2012 Copyright (c) 1982, 2010, Oracle. All rights reserved. 连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select instance_name from v$instance; INSTANCE_NAME -------------------------------- +ASM
三、总结
1.在动态监听中,只有设置了(UR=A)才能够远程访问ASM实例;
2.在静态监听中,无论是否设置(UR=A)均可远程访问ASM实例,甚至可以使用easy connect方法方法ASM实例。
发表在 Oracle ASM
一条评论
ASM迁移至文件系统
--创建pfile文件 SQL> create pfile ='/tmp/pfile' from spfile; File created. SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production With the Partitioning, OLAP and Data Mining options --修改pfile中关于asm中的内容 control_files db_recovery_file_dest log_archive_dest_1 指定到文件系统 --登录rman [oracle@localhost tmp]$ rman target / Recovery Manager: Release 10.2.0.3.0 - Production on Mon Jun 27 12:48:26 2011 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: TOS (DBID=1569606545) --执行backup as copy datafile RMAN> backup as copy datafile '+DATA/tos/datafile/users.276.754906035' format '/u01/oradata/tos/USERS01.dbf'; Starting backup at 27-JUN-11 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=141 devtype=DISK channel ORA_DISK_1: starting datafile copy input datafile fno=00004 name=+DATA/tos/datafile/users.276.754906035 output filename=/u01/oradata/tos/USERS01.dbf tag=TAG20110627T124853 recid=17 stamp=754922939 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07 Finished backup at 27-JUN-11 RMAN> backup as copy datafile '+DATA/tos/datafile/sysaux.271.754905929' format '/u01/oradata/tos/SYSAUX01.dbf'; Starting backup at 27-JUN-11 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy input datafile fno=00003 name=+DATA/tos/datafile/sysaux.271.754905929 output filename=/u01/oradata/tos/SYSAUX01.dbf tag=TAG20110627T124929 recid=18 stamp=754923029 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:05 Finished backup at 27-JUN-11 RMAN> backup as copy datafile '+DATA/tos/datafile/undotbs1.273.754906021' format '/u01/oradata/tos/UNDOTBS101.dbf'; Starting backup at 27-JUN-11 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy input datafile fno=00002 name=+DATA/tos/datafile/undotbs1.273.754906021 output filename=/u01/oradata/tos/UNDOTBS101.dbf tag=TAG20110627T125049 recid=19 stamp=754923057 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15 Finished backup at 27-JUN-11 RMAN> backup as copy datafile '+DATA/tos/datafile/system.270.754905833' format '/u01/oradata/tos/SYSTEM01.dbf'; Starting backup at 27-JUN-11 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy input datafile fno=00001 name=+DATA/tos/datafile/system.270.754905833 output filename=/u01/oradata/tos/SYSTEM01.dbf tag=TAG20110627T125112 recid=20 stamp=754923150 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:25 channel ORA_DISK_1: starting datafile copy copying current control file RMAN-03009: failure of backup command on ORA_DISK_1 channel at 06/27/2011 12:52:39 ORA-01580: error creating control backup file /u01/oradata/tos/SYSTEM01.dbf ORA-27038: created file already exists Additional information: 1 continuing other job steps, job failed will not be re-run channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset including current SPFILE in backupset channel ORA_DISK_1: starting piece 1 at 27-JUN-11 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03009: failure of backup command on ORA_DISK_1 channel at 06/27/2011 12:52:42 ORA-19504: failed to create file "/u01/oradata/tos/SYSTEM01.dbf" ORA-27038: created file already exists Additional information: 1 注:因为默认情况下,备份system数据文件是,会自动备份控制文件,这里因为system01.dbf已经备份好,而控制文件再次备份为该名称所以失败 RMAN> backup as copy datafile '+DATA/tos/datafile/example.272.754905995' format '/u01/oradata/tos/EXAMPLE01.dbf'; Starting backup at 27-JUN-11 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy input datafile fno=00005 name=+DATA/tos/datafile/example.272.754905995 output filename=/u01/oradata/tos/EXAMPLE01.dbf tag=TAG20110627T125341 recid=21 stamp=754923244 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25 Finished backup at 27-JUN-11 RMAN> backup as copy datafile '+DATA/tos/datafile/xff.274.754906027' format '/u01/oradata/tos/XFF01.dbf'; Starting backup at 27-JUN-11 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy input datafile fno=00006 name=+DATA/tos/datafile/xff.274.754906027 output filename=/u01/oradata/tos/XFF01.dbf tag=TAG20110627T125415 recid=22 stamp=754923257 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03 Finished backup at 27-JUN-11 RMAN> backup as copy datafile '+DATA/tos/datafile/xff.275.754906031' format '/u01/oradata/tos/XFF02.dbf'; Starting backup at 27-JUN-11 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy input datafile fno=00007 name=+DATA/tos/datafile/xff.275.754906031 output filename=/u01/oradata/tos/XFF02.dbf tag=TAG20110627T125507 recid=23 stamp=754923309 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:04 Finished backup at 27-JUN-11 RMAN> exit Recovery Manager complete. --登录sqlplus [oracle@localhost tmp]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.3.0 - Production on Mon Jun 27 12:55:29 2011 Copyright (c) 1982, 2006, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production With the Partitioning, OLAP and Data Mining options --备份控制文件 SQL> alter database backup controlfile to '/tmp/control.ctl'; Database altered. --关闭数据库 SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. --启动数据库只nomount状态 SQL> startup pfile='/tmp/pfile' nomount; ORACLE instance started. Total System Global Area 167772160 bytes Fixed Size 1260672 bytes Variable Size 79692672 bytes Database Buffers 79691776 bytes Redo Buffers 7127040 bytes SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production With the Partitioning, OLAP and Data Mining options [oracle@localhost tmp]$ rman target / Recovery Manager: Release 10.2.0.3.0 - Production on Mon Jun 27 12:58:22 2011 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: tos (not mounted) --恢复控制文件 RMAN> restore controlfile from '/tmp/control.ctl'; Starting restore at 27-JUN-11 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=156 devtype=DISK channel ORA_DISK_1: copied control file copy output filename=/u01/oradata/tos/control01.ctl output filename=/u01/oradata/tos/control02.ctl Finished restore at 27-JUN-11 --启动数据库只mount状态 RMAN> alter database mount; database mounted released channel: ORA_DISK_1 --修改数据文件在控制文件中位置 RMAN> switch tablespace SYSTEM to copy; Starting implicit crosscheck backup at 27-JUN-11 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=156 devtype=DISK Finished implicit crosscheck backup at 27-JUN-11 Starting implicit crosscheck copy at 27-JUN-11 using channel ORA_DISK_1 Crosschecked 15 objects Finished implicit crosscheck copy at 27-JUN-11 searching for all files in the recovery area cataloging files... no files cataloged datafile 1 switched to datafile copy "/u01/oradata/tos/SYSTEM01.dbf" RMAN> switch tablespace UNDOTBS1 to copy; datafile 2 switched to datafile copy "/u01/oradata/tos/UNDOTBS101.dbf" RMAN> switch tablespace SYSAUX to copy; datafile 3 switched to datafile copy "/u01/oradata/tos/SYSAUX01.dbf" RMAN> switch tablespace USERS to copy; datafile 4 switched to datafile copy "/u01/oradata/tos/USERS01.dbf" RMAN> switch tablespace EXAMPLE to copy; datafile 5 switched to datafile copy "/u01/oradata/tos/EXAMPLE01.dbf" RMAN> switch tablespace XFF to copy; datafile 6 switched to datafile copy "/u01/oradata/tos/XFF01.dbf" datafile 7 switched to datafile copy "/u01/oradata/tos/XFF02.dbf" --恢复数据库 RMAN> recover database; Starting recover at 27-JUN-11 using channel ORA_DISK_1 starting media recovery archive log thread 1 sequence 9 is already on disk as file +DATA/tos/onlinelog/group_6.279.754906321 archive log filename=+DATA/tos/onlinelog/group_6.279.754906321 thread=1 sequence=9 media recovery complete, elapsed time: 00:00:03 Finished recover at 27-JUN-11 --打开数据库 RMAN> alter database open; RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of alter db command at 06/27/2011 13:00:36 ORA-01589: must use RESETLOGS or NORESETLOGS option for database open RMAN> alter database open resetlogs; database opened 注:不能直接使用open打开 RMAN> exit Recovery Manager complete. [oracle@localhost tmp]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.3.0 - Production on Mon Jun 27 13:02:53 2011 Copyright (c) 1982, 2006, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production With the Partitioning, OLAP and Data Mining options --增加redo log SQL> alter database add logfile group 1 '/u01/oradata/tos/redo01.log' size 10m; Database altered. SQL> alter database add logfile group 2 '/u01/oradata/tos/redo02.log' size 10m; Database altered. SQL> alter database add logfile group 3 '/u01/oradata/tos/redo03.log' size 10m; Database altered. --切换日志 SQL> alter system switch logfile; System altered. SQL> / System altered. SQL> / System altered. SQL> / System altered. --内存中数据写入硬盘 SQL> alter system checkpoint; System altered. --查询当前日志组状态 SQL> select group#,status from v$log; GROUP# STATUS ---------- ---------------- 1 CURRENT 2 INACTIVE 3 INACTIVE 4 INACTIVE 5 INACTIVE 6 INACTIVE 6 rows selected. --删除asm中日志 SQL> alter database drop logfile group 4; Database altered. SQL> alter database drop logfile group 5; Database altered. SQL> alter database drop logfile group 6; Database altered. --添加临时文件 SQL> alter tablespace temp add tempfile '/u01/oradata/tos/temp01.dbf' size 30m autoextend on maxsize 1g; Tablespace altered. --查看临时表空间中临时文件 SQL> select name from v$tempfile; NAME -------------------------------------------------------------------------------- /u01/oradata/tos/temp01.dbf +DATA/tos/tempfile/temp.280.754906369 --删除asm中临时文件 SQL> alter tablespace temp drop tempfile '+DATA/tos/tempfile/temp.280.754906369'; Tablespace altered. --查看迁移结果 SQL> set pagesize 100 SQL> select name from v$datafile 2 union 3 select member from v$logfile 4 union 5 select name from v$controlfile 6 union 7 select name from v$tempfile; NAME ------------------------------------------------------------------ /u01/oradata/tos/EXAMPLE01.dbf /u01/oradata/tos/SYSAUX01.dbf /u01/oradata/tos/SYSTEM01.dbf /u01/oradata/tos/UNDOTBS101.dbf /u01/oradata/tos/USERS01.dbf /u01/oradata/tos/XFF01.dbf /u01/oradata/tos/XFF02.dbf /u01/oradata/tos/control01.ctl /u01/oradata/tos/control02.ctl /u01/oradata/tos/redo01.log /u01/oradata/tos/redo02.log /u01/oradata/tos/redo03.log /u01/oradata/tos/temp01.dbf 13 rows selected. --创建spfile文件 SQL> create spfile from pfile='/tmp/pfile'; File created.
发表在 Oracle ASM
2 条评论