Bo's Oracle Station

查看: 1365|回复: 0

课程第7次

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2019-5-22 20:15:00 | 显示全部楼层 |阅读模式
2019-05-22

第一个advisor
1.png

备份控制文件恢复(8a):
  1. [oracle@station80 ~]$ . oraenv
  2. ORACLE_SID = [orcl] ? +ASM
  3. The Oracle base remains unchanged with value /u01/app/oracle
  4. [oracle@station80 ~]$ asmcmd
  5. ASMCMD> ls
  6. DATA/
  7. FRA/
  8. ASMCMD> cd data
  9. ASMCMD> ls
  10. ASM/
  11. ORCL/
  12. ASMCMD> cd orcl
  13. ASMCMD> ls
  14. CONTROLFILE/
  15. DATAFILE/
  16. PARAMETERFILE/
  17. TEMPFILE/
  18. spfileorcl.ora
  19. ASMCMD> cd +FRA
  20. ASMCMD> ls
  21. ORCL/
  22. ASMCMD> cd orcl
  23. ASMCMD> ls
  24. CONTROLFILE/
  25. ASMCMD> exit
  26. [oracle@station80 ~]$ . oraenv
  27. ORACLE_SID = [+ASM] ? orcl
  28. The Oracle base remains unchanged with value /u01/app/oracle
  29. [oracle@station80 ~]$ sqlplus /nolog

  30. SQL*Plus: Release 11.2.0.4.0 Production on Wed May 22 21:08:19 2019

  31. Copyright (c) 1982, 2013, Oracle.  All rights reserved.

  32. SQL> conn / as sysdba
  33. Connected to an idle instance.
  34. SQL> startup mount
  35. ORACLE instance started.

  36. Total System Global Area 1536602112 bytes
  37. Fixed Size                  2253504 bytes
  38. Variable Size             939527488 bytes
  39. Database Buffers          587202560 bytes
  40. Redo Buffers                7618560 bytes
  41. Database mounted.
  42. SQL> alter database open resetlogs;
  43. alter database open resetlogs
  44. *
  45. ERROR at line 1:
  46. ORA-01139: RESETLOGS option only valid after an incomplete database recovery


  47. SQL> recover database until cancel ;
  48. Media recovery complete.
  49. SQL> alter database open ;
  50. alter database open
  51. *
  52. ERROR at line 1:
  53. ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


  54. SQL> alter database open resetlogs;

  55. Database altered.

  56. SQL> select  open_mode from v$database;

  57. OPEN_MODE
  58. --------------------
  59. READ WRITE

  60. SQL> archive log list
  61. Database log mode              No Archive Mode
  62. Automatic archival             Disabled
  63. Archive destination            USE_DB_RECOVERY_FILE_DEST
  64. Oldest online log sequence     1
  65. Current log sequence           1
  66. SQL> alter database backup controlfile to '/home/oracle/control.f';

  67. Database altered.

  68. SQL> exit
  69. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64                                                                             bit Production
  70. With the Partitioning, Automatic Storage Management, OLAP, Data Mining
  71. and Real Application Testing options
  72. [oracle@station80 ~]$ rman target /

  73. Recovery Manager: Release 11.2.0.4.0 - Production on Wed May 22 21:28:41 2019

  74. Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

  75. connected to target database: ORCL (DBID=1535788302)

  76. RMAN> backup current controlfile;

  77. Starting backup at 22-MAY-19
  78. using target database control file instead of recovery catalog
  79. allocated channel: ORA_DISK_1
  80. channel ORA_DISK_1: SID=34 device type=DISK
  81. channel ORA_DISK_1: starting full datafile backup set
  82. channel ORA_DISK_1: specifying datafile(s) in backup set
  83. including current control file in backup set
  84. channel ORA_DISK_1: starting piece 1 at 22-MAY-19
  85. channel ORA_DISK_1: finished piece 1 at 22-MAY-19
  86. piece handle=+FRA/orcl/backupset/2019_05_22/ncnnf0_tag20190522t212937_0.260.1008                                                                             970179 tag=TAG20190522T212937 comment=NONE
  87. channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
  88. Finished backup at 22-MAY-19

  89. RMAN> list backup;


  90. List of Backup Sets
  91. ===================


  92. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  93. ------- ---- -- ---------- ----------- ------------ ---------------
  94. 1       Full    9.33M      DISK        00:00:01     22-MAY-19
  95.         BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20190522T212937
  96.         Piece Name: +FRA/orcl/backupset/2019_05_22/ncnnf0_tag20190522t212937_0.2                                                                             60.1008970179
  97.   Control File Included: Ckp SCN: 1137211      Ckp time: 22-MAY-19

  98. RMAN> exit


  99. Recovery Manager complete.
  100. [oracle@station80 ~]$ ls -l /home/oracle/control.f
  101. -rw-r-----. 1 oracle asmadmin 9748480 May 22 21:27 /home/oracle/control.f
  102. [oracle@station80 ~]$ file /home/oracle/control.f
  103. /home/oracle/control.f: data
  104. [oracle@station80 ~]
    1. select  * from v$log;

    2. select  * from v$logfile;


    3. alter database add logfile member '/home/oracle/redo02c.log' to group 2;

    4. alter database drop logfile member '/home/oracle/redo02c.log';

    5. alter system switch logfile;

    6. alter database drop logfile member '/home/oracle/redo02c.log';
    复制代码
    nbsp; . oraenv
  105. -bash: ▒.: command not found
  106. [oracle@station80 ~]$ . oraenv
  107. ORACLE_SID = [orcl] ? +ASM
  108. The Oracle base remains unchanged with value /u01/app/oracle
  109. [oracle@station80 ~]$ asmcmd
  110. ASMCMD> ls
  111. DATA/
  112. FRA/
  113. ASMCMD> cd DATA/
  114. ASMCMD> ls
  115. ASM/
  116. ORCL/
  117. ASMCMD> cd orcl
  118. ASMCMD> ls
  119. DATAFILE/
  120. ONLINELOG/
  121. PARAMETERFILE/
  122. TEMPFILE/
  123. spfileorcl.ora
  124. ASMCMD> cd +FRA
  125. ASMCMD> ls
  126. ORCL/
  127. ASMCMD> cd orcl
  128. ASMCMD> ls
  129. BACKUPSET/
  130. ONLINELOG/
  131. ASMCMD> exit
  132. [oracle@station80 ~]$ . oraenv
  133. ORACLE_SID = [+ASM] ? orcl
  134. The Oracle base remains unchanged with value /u01/app/oracle
  135. [oracle@station80 ~]$ sqlplus /nolog

  136. SQL*Plus: Release 11.2.0.4.0 Production on Wed May 22 21:41:49 2019

  137. Copyright (c) 1982, 2013, Oracle.  All rights reserved.

  138. SQL> conn / as sysdba
  139. Connected to an idle instance.
  140. SQL> startup
  141. ORACLE instance started.

  142. Total System Global Area 1536602112 bytes
  143. Fixed Size                  2253504 bytes
  144. Variable Size             939527488 bytes
  145. Database Buffers          587202560 bytes
  146. Redo Buffers                7618560 bytes
  147. ORA-00205: error in identifying control file, check alert log for more info


  148. SQL> show parameter control

  149. NAME                                 TYPE
  150. ------------------------------------ ---------------------------------
  151. VALUE
  152. ------------------------------
  153. control_file_record_keep_time        integer
  154. 7
  155. control_files                        string
  156. +DATA/orcl/controlfile/current
  157. .260.1008007567, +FRA/orcl/con
  158. trolfile/current.256.100800756
  159. 7
  160. control_management_pack_access       string
  161. DIAGNOSTIC+TUNING
  162. SQL> exit
  163. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64                                                                             bit Production
  164. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  165. [oracle@station80 ~]$ rman target /

  166. Recovery Manager: Release 11.2.0.4.0 - Production on Wed May 22 21:43:56 2019

  167. Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

  168. connected to target database: ORCL (not mounted)

  169. RMAN> list backup of controlfile;

  170. using target database control file instead of recovery catalog
  171. RMAN-00571: ===========================================================
  172. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  173. RMAN-00571: ===========================================================
  174. RMAN-03002: failure of list command at 05/22/2019 21:45:23
  175. ORA-01507: database not mounted

  176. RMAN> exit


  177. Recovery Manager complete.
  178. [oracle@station80 ~]$ . oraenv
  179. ORACLE_SID = [orcl] ? +ASM
  180. ORACLE_HOME = [/home/oracle] ?
  181. ORACLE_BASE environment variable is not being set since this
  182. information is not available for the current user ID oracle.
  183. You can set ORACLE_BASE manually if it is required.
  184. [oracle@station80 ~]$ . oraenv
  185. ORACLE_SID = ['+ASM] ? +ASM
  186. The Oracle base has been set to /u01/app/oracle
  187. [oracle@station80 ~]$ asmcmd
  188. ASMCMD> ls
  189. DATA/
  190. FRA/
  191. ASMCMD> cd fra
  192. ASMCMD> ls
  193. ORCL/
  194. ASMCMD> cd orcl
  195. ASMCMD> ls
  196. BACKUPSET/
  197. ONLINELOG/
  198. ASMCMD> cd BACKUPSET/
  199. ASMCMD> ls
  200. 2019_05_22/
  201. ASMCMD> cd 2019_05_22/
  202. ASMCMD> ls
  203. ncnnf0_LABS-8A-CONTROLFILE_0.261.1008970613
  204. ncnnf0_TAG20190522T212937_0.260.1008970179
  205. ASMCMD> pwd
  206. +fra/orcl/BACKUPSET/2019_05_22
  207. ASMCMD> exit
  208. [oracle@station80 ~]$ . oraenv
  209. ORACLE_SID = [+ASM] ? orcl
  210. The Oracle base remains unchanged with value /u01/app/oracle
  211. [oracle@station80 ~]$ rman target  /

  212. Recovery Manager: Release 11.2.0.4.0 - Production on Wed May 22 21:46:45 2019

  213. Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

  214. connected to target database: ORCL (not mounted)

  215. RMAN> restore controlfile from '+fra/orcl/BACKUPSET/2019_05_22/ncnnf0_LABS-8A-CO                                                                             NTROLFILE_0.261.1008970613';

  216. Starting restore at 22-MAY-19
  217. using target database control file instead of recovery catalog
  218. allocated channel: ORA_DISK_1
  219. channel ORA_DISK_1: SID=12 device type=DISK

  220. channel ORA_DISK_1: restoring control file
  221. channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
  222. output file name=+DATA/orcl/controlfile/current.260.1008971239
  223. output file name=+FRA/orcl/controlfile/current.256.1008971239
  224. Finished restore at 22-MAY-19

  225. RMAN> alter database mount;

  226. database mounted
  227. released channel: ORA_DISK_1

  228. RMAN> exit


  229. Recovery Manager complete.
  230. [oracle@station80 ~]$ sqlplus /nolog

  231. SQL*Plus: Release 11.2.0.4.0 Production on Wed May 22 21:47:51 2019

  232. Copyright (c) 1982, 2013, Oracle.  All rights reserved.

  233. SQL> conn / as sysdba
  234. Connected.
  235. SQL> show parameter control

  236. NAME                                 TYPE        VALUE
  237. ------------------------------------ ----------- ------------------------------
  238. control_file_record_keep_time        integer     7
  239. control_files                        string      +DATA/orcl/controlfile/current
  240.                                                  .260.1008971239, +FRA/orcl/con
  241.                                                  trolfile/current.256.100897123
  242.                                                  9
  243. control_management_pack_access       string      DIAGNOSTIC+TUNING
  244. SQL> exit
  245. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64                                                                             bit Production
  246. With the Partitioning, Automatic Storage Management, OLAP, Data Mining
  247. and Real Application Testing options
  248. [oracle@station80 ~]$rman target /
  249. -bash: ▒rman: command not found
  250. [oracle@station80 ~]$ ▒rman target /
  251. -bash: ▒rman: command not found
  252. [oracle@station80 ~]$
  253. [oracle@station80 ~]$
  254. [oracle@station80 ~]$
  255. [oracle@station80 ~]$ rman target /
  256. -bash: ▒rman: command not found
  257. [oracle@station80 ~]$
  258. [oracle@station80 ~]$
  259. [oracle@station80 ~]$
  260. [oracle@station80 ~]$ . oraenv
  261. ORACLE_SID = [orcl] ?
  262. The Oracle base remains unchanged with value /u01/app/oracle
  263. [oracle@station80 ~]$ rman target  /

  264. Recovery Manager: Release 11.2.0.4.0 - Production on Wed May 22 21:49:57 2019

  265. Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

  266. connected to target database: ORCL (DBID=1535788302, not open)

  267. RMAN> alter database open ;

  268. using target database control file instead of recovery catalog
  269. RMAN-00571: ===========================================================
  270. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  271. RMAN-00571: ===========================================================
  272. RMAN-03002: failure of alter db command at 05/22/2019 21:50:13
  273. ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

  274. RMAN> alter database open  resetlogs;

  275. RMAN-00571: ===========================================================
  276. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  277. RMAN-00571: ===========================================================
  278. RMAN-03002: failure of alter db command at 05/22/2019 21:50:23
  279. ORA-01194: file 1 needs more recovery to be consistent
  280. ORA-01110: data file 1: '+DATA/orcl/datafile/system.256.1008007421'

  281. RMAN> recover database;

  282. Starting recover at 22-MAY-19
  283. Starting implicit crosscheck backup at 22-MAY-19
  284. allocated channel: ORA_DISK_1
  285. channel ORA_DISK_1: SID=12 device type=DISK
  286. Crosschecked 1 objects
  287. Finished implicit crosscheck backup at 22-MAY-19

  288. Starting implicit crosscheck copy at 22-MAY-19
  289. using channel ORA_DISK_1
  290. Crosschecked 2 objects
  291. Finished implicit crosscheck copy at 22-MAY-19

  292. searching for all files in the recovery area
  293. cataloging files...
  294. cataloging done

  295. List of Cataloged Files
  296. =======================
  297. File Name: +fra/ORCL/BACKUPSET/2019_05_22/ncnnf0_LABS-8A-CONTROLFILE_0.261.10089                                                                             70613

  298. using channel ORA_DISK_1

  299. starting media recovery

  300. archived log for thread 1 with sequence 5 is already on disk as file +DATA/orcl/                                                                             onlinelog/group_2.262.1008969079
  301. archived log for thread 1 with sequence 6 is already on disk as file +DATA/orcl/                                                                             onlinelog/group_3.261.1008969081
  302. archived log for thread 1 with sequence 7 is already on disk as file +DATA/orcl/                                                                             onlinelog/group_1.263.1008969079
  303. archived log file name=+DATA/orcl/onlinelog/group_2.262.1008969079 thread=1 sequ                                                                             ence=5
  304. archived log file name=+DATA/orcl/onlinelog/group_3.261.1008969081 thread=1 sequ                                                                             ence=6
  305. archived log file name=+DATA/orcl/onlinelog/group_1.263.1008969079 thread=1 sequ                                                                             ence=7
  306. media recovery complete, elapsed time: 00:00:00
  307. Finished recover at 22-MAY-19

  308. RMAN> alter database open;

  309. RMAN-00571: ===========================================================
  310. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  311. RMAN-00571: ===========================================================
  312. RMAN-03002: failure of alter db command at 05/22/2019 21:51:36
  313. ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

  314. RMAN> alter database open resetogs;

  315. RMAN-00571: ===========================================================
  316. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  317. RMAN-00571: ===========================================================
  318. RMAN-00558: error encountered while parsing input commands
  319. RMAN-01009: syntax error: found "identifier": expecting one of: "resetlogs, ;"
  320. RMAN-01008: the bad identifier was: resetogs
  321. RMAN-01007: at line 1 column 21 file: standard input

  322. RMAN> alter database open resetlogs;

  323. database opened

  324. RMAN> list incarnation of database ;


  325. List of Database Incarnations
  326. DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
  327. ------- ------- -------- ---------------- --- ---------- ----------
  328. 1       1       ORCL     1535788302       PARENT  1          24-AUG-13
  329. 2       2       ORCL     1535788302       PARENT  925702     11-MAY-19
  330. 3       3       ORCL     1535788302       PARENT  1134795    22-MAY-19
  331. 4       4       ORCL     1535788302       CURRENT 1138641    22-MAY-19

  332. RMAN>
复制代码
关于日志成员:
  1. select  * from v$log;

  2. select  * from v$logfile;


  3. alter database add logfile member '/home/oracle/redo02c.log' to group 2;

  4. alter database drop logfile member '/home/oracle/redo02c.log';

  5. alter system switch logfile;

  6. alter database drop logfile member '/home/oracle/redo02c.log';
复制代码



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-5-20 16:53 , Processed in 0.044207 second(s), 27 queries .

快速回复 返回顶部 返回列表