Bo's Oracle Station

查看: 1212|回复: 0

课程第13/14次(2016-11-27星期日上下午)

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2016-11-28 10:42:09 | 显示全部楼层 |阅读模式
上完1Z0-052第14章(Oracle数据库的热备份,表空间级的检查点)
(052共19章,053共21章,063多租户共9章,49-8)

2016-11-27.sql:
  1. select   d.CHECKPOINT_CHANGE# , d.CURRENT_SCN   from
  2. v_$database  d;


  3. select  df.FILE#,  df.CHECKPOINT_CHANGE#, status
  4.   from v_$datafile df;
  5.   
  6.   select   * from dba_data_files;
  7.    
  8.   
  9.   alter  tablespace  sysaux offline ;
  10.   
  11.   alter system checkpoint;
  12.   
  13.   alter tablespace sysaux online;
  14.   ---------
  15.   
  16.   alter database datafile 2 offline ;
  17.   
  18.     alter database datafile 2 online ;
  19.     ----

  20. select   * from v$datafile ;

  21. alter database datafile 2 online;

  22. alter tablespace sysaux online;

  23. select   * from v$datafile;

  24. ----
  25. select  * from v$log;
  26. ----

  27. select  * from v$logfile;
  28. alter database drop logfile group 3;

  29. alter system switch logfile;
  30. ----
  31. select   * from v$datafile ;

  32. alter database datafile 2 online;

  33. alter tablespace sysaux online;

  34. select   * from v$datafile;

  35. ----
  36. select  * from v$log;
  37. ----

  38. select  * from v$logfile;
  39. alter database drop logfile group 3;

  40. alter database add logfile group 3 size 60M ;

  41. alter database drop logfile group 1;

  42. alter database add logfile group 1 size 60M ;


  43. alter database drop logfile group 2;

  44. alter system switch logfile;

  45. alter system checkpoint;
  46. alter database drop logfile group 2;

  47. alter database add logfile group 2 size 60M ;

  48. alter  database add logfile member '/u01/app/oracle/redo01c.log' to group 1;

  49. alter  database add logfile member '/u01/app/oracle/redo02c.log' to group 2;

  50. alter database drop logfile  member '/u01/app/oracle/redo01c.log';

  51. alter  database drop logfile member '/u01/app/oracle/redo02c.log';

  52. select  resetlogs_change#, checkpoint_change# , current_scn from v$database;

  53. select  * from v$database_incarnation;

  54. select  * from v$logfile;


  55. select  * from v$log;

  56. alter database add logfile group 4  ('/u01/app/oracle/redo04a.log','/u01/app/oracle/redo04b.log')
  57.   size 60M  ;
  58.   
  59.   alter system archive log current;
  60.   
  61.   alter database drop logfile member '/u01/app/oracle/redo04b.log';
  62.   
  63.   alter database add logfile member '/u01/app/oracle/redo04b.log' to group 4;
  64.   ---
  65.   
  66.   select  * from v$archived_log;
  67.   
  68.   
  69.   
  70.    
复制代码

rcat换控制文件:
  1. [oracle@station90 oracle]$ . oraenv
  2. ORACLE_SID = [orcl] ? rcat
  3. The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
  4. [oracle@station90 oracle]$ sqlplus /nolog

  5. SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 27 16:41:27 2016

  6. Copyright (c) 1982, 2009, Oracle.  All rights reserved.

  7. SQL> conn / as sysdba
  8. Connected.
  9. SQL> show parameter db_recovery

  10. NAME                                     TYPE         VALUE
  11. ------------------------------------ ----------- ------------------------------
  12. db_recovery_file_dest                     string         /u01/app/oracle/flash_recovery
  13.                                                  _area
  14. db_recovery_file_dest_size             big integer 3882M
  15. SQL> exit
  16. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
  17. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  18. [oracle@station90 oracle]$ cd /u01/app/oracle/flash_recovery_area/
  19. [oracle@station90 flash_recovery_area]$ LS
  20. -bash: LS: command not found
  21. [oracle@station90 flash_recovery_area]$ ls
  22. rcat  RCAT
  23. [oracle@station90 flash_recovery_area]$ cd RCAT
  24. [oracle@station90 RCAT]$ ls
  25. onlinelog
  26. [oracle@station90 RCAT]$ sqlplus /nolog

  27. SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 27 16:47:38 2016

  28. Copyright (c) 1982, 2009, Oracle.  All rights reserved.

  29. SQL> conn / as sysdba
  30. Connected.
  31. SQL> show parameter db_create_file_dest

  32. NAME                                     TYPE         VALUE
  33. ------------------------------------ ----------- ------------------------------
  34. db_create_file_dest                     string         /u01/app/oracle/oradata
  35. SQL> exit
  36. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
  37. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  38. [oracle@station90 RCAT]$ cd /u01/app/oracle/oradata/
  39. [oracle@station90 oradata]$ ls
  40. rcat  RCAT
  41. [oracle@station90 oradata]$ cd RCAT
  42. [oracle@station90 RCAT]$ ls
  43. datafile
  44. [oracle@station90 RCAT]$ cd datafile/
  45. [oracle@station90 datafile]$ ls
  46. o1_mf_botangtb_d2y1ddb3_.dbf  o1_mf_botangtb_d2y1dgbs_.dbf
  47. [oracle@station90 datafile]$ cd
  48. [oracle@station90 ~]$ sqlplus /nolog

  49. SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 27 16:50:20 2016

  50. Copyright (c) 1982, 2009, Oracle.  All rights reserved.

  51. SQL> conn / as sysdba
  52. Connected.
  53. SQL> create tablespace tbs1 ;

  54. Tablespace created.

  55. SQL> exit
  56. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
  57. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  58. [oracle@station90 ~]$ ls
  59. afiedt.buf               oradiag_oracle        reset_JSON                                   shrink.sh                 公共的
  60. apex                     oraInventory          reset_rest                                   shrink_undo.sql           模板
  61. app                      ords                  reset_soup                                   sqldeveloper              视频
  62. copytape-root.sh         ords.sh               reset_soup_apex_only                         s_rest.zip                图片
  63. create_t04209_uname.sql  osb.txt               reset_sqldev                                 sysaux01.dbf              文档
  64. derby.log                pdb_open_says_me.sql  reset_xmldb                                  tnsnames.ora              下载
  65. mail                     p.sql                 restclient-ui-3.1-jar-with-dependencies.jar  ttio.rcv                  音乐
  66. one_time_setup.sql       rac_tns               revertape-root.sh                            update2_t04209_uname.sql  桌面
  67. oracle                   reset_apex            select_t04209_uname.sql                      update_t04209_uname.sql
  68. [oracle@station90 ~]$ cd /u01/app/oracle/oradata/
  69. [oracle@station90 oradata]$ ls
  70. rcat  RCAT
  71. [oracle@station90 oradata]$ cd RCAT/
  72. [oracle@station90 RCAT]$ ls
  73. datafile
  74. [oracle@station90 RCAT]$ cd datafile/
  75. [oracle@station90 datafile]$ ls
  76. o1_mf_botangtb_d2y1ddb3_.dbf  o1_mf_botangtb_d2y1dgbs_.dbf  o1_mf_tbs1_d3o7ln9p_.dbf
  77. [oracle@station90 datafile]$ du -sh o1_mf_tbs1_d3o7ln9p_.dbf
  78. 101M        o1_mf_tbs1_d3o7ln9p_.dbf
  79. [oracle@station90 datafile]$ sqlplus /nolog

  80. SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 27 16:51:41 2016

  81. Copyright (c) 1982, 2009, Oracle.  All rights reserved.

  82. SQL> conn / as sysdba
  83. Connected.
  84. SQL> show parameter db_create

  85. NAME                                     TYPE         VALUE
  86. ------------------------------------ ----------- ------------------------------
  87. db_create_file_dest                     string         /u01/app/oracle/oradata
  88. db_create_online_log_dest_1             string
  89. db_create_online_log_dest_2             string
  90. db_create_online_log_dest_3             string
  91. db_create_online_log_dest_4             string
  92. db_create_online_log_dest_5             string
  93. SQL> alter system set db_create_file_dest='';

  94. System altered.

  95. SQL> create tablespace tbs2 ;
  96. create tablespace tbs2
  97.                       *
  98. ERROR at line 1:
  99. ORA-02199: missing DATAFILE/TEMPFILE clause


  100. SQL> exit
  101. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
  102. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  103. [oracle@station90 datafile]$ rman target /

  104. Recovery Manager: Release 11.2.0.1.0 - Production on Sun Nov 27 16:52:23 2016

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

  106. connected to target database: RCAT (DBID=590260915)

  107. RMAN> backup tablespace sysaux ;

  108. Starting backup at 27-NOV-16
  109. using target database control file instead of recovery catalog
  110. allocated channel: ORA_DISK_1
  111. channel ORA_DISK_1: SID=623 device type=DISK
  112. channel ORA_DISK_1: starting full datafile backup set
  113. channel ORA_DISK_1: specifying datafile(s) in backup set
  114. input datafile file number=00002 name=/u01/app/oracle/oradata/rcat/sysaux01.dbf
  115. channel ORA_DISK_1: starting piece 1 at 27-NOV-16
  116. channel ORA_DISK_1: finished piece 1 at 27-NOV-16
  117. piece handle=/u01/app/oracle/flash_recovery_area/RCAT/backupset/2016_11_27/o1_mf_nnndf_TAG20161127T165231_d3o7phr4_.bkp tag=TAG20161127T165231 comment=NONE
  118. channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
  119. Finished backup at 27-NOV-16

  120. RMAN> exit


  121. Recovery Manager complete.
  122. [oracle@station90 datafile]$ cd /u01/app/
  123. [oracle@station90 app]$ ls
  124. oracle  oraInventory
  125. [oracle@station90 app]$ cd oracle/
  126. [oracle@station90 oracle]$ ls
  127. admin        cfgtoollogs  diag                 man_recovery_area      oradata  redo01c.log  temp02.dbf
  128. botangdir01  checkpoints  flash_recovery_area  man_recovery_area.11g  product  redo02c.log  wallet
  129. [oracle@station90 oracle]$ cd flash_recovery_area/
  130. [oracle@station90 flash_recovery_area]$ ls
  131. rcat  RCAT
  132. [oracle@station90 flash_recovery_area]$ cd RCAT/
  133. [oracle@station90 RCAT]$ ls
  134. backupset  onlinelog
  135. [oracle@station90 RCAT]$ sqlplus /nolog

  136. SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 27 16:53:15 2016

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

  138. SQL> conn / as sysdba
  139. Connected.
  140. SQL> alter system switch logfile;

  141. System altered.

  142. SQL> exit
  143. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
  144. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  145. [oracle@station90 RCAT]$ ls
  146. archivelog  backupset  onlinelog
  147. [oracle@station90 RCAT]$ cd archivelog
  148. [oracle@station90 archivelog]$ ls
  149. 2016_11_27
  150. [oracle@station90 archivelog]$ cd 2016_11_27
  151. [oracle@station90 2016_11_27]$ ls
  152. o1_mf_1_18_d3o7r6cn_.arc
  153. [oracle@station90 2016_11_27]$ sqlplus /nolog

  154. SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 27 16:55:15 2016

  155. Copyright (c) 1982, 2009, Oracle.  All rights reserved.

  156. SQL> conn / as sysdba
  157. Connected.
  158. SQL> set linesize 1000
  159. SQL> select  * from v$log;

  160.     GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE          MEMBERS ARC STATUS               FIRST_CHANGE# FIRST_TIME         NEXT_CHANGE# NEXT_TIME
  161. ---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ------------------ ------------ ------------------
  162.          1            1              19   52428800           512                1 NO  CURRENT                     1391912 27-NOV-16                  2.8147E+14
  163.          2            1              17   52428800           512                1 YES INACTIVE                     1365146 26-NOV-16                     1379922 27-NOV-16
  164.          3            1              18   52428800           512                1 YES ACTIVE                     1379922 27-NOV-16                     1391912 27-NOV-16

  165. SQL> select  member from v$logfile;

  166. MEMBER
  167. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  168. /u01/app/oracle/oradata/rcat/redo03.log
  169. /u01/app/oracle/oradata/rcat/redo02.log
  170. /u01/app/oracle/oradata/rcat/redo01.log

  171. SQL> alter database add logfile group 4 size 52428800;

  172. Database altered.

  173. SQL> select  member from v$logfile;

  174. MEMBER
  175. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  176. /u01/app/oracle/oradata/rcat/redo03.log
  177. /u01/app/oracle/oradata/rcat/redo02.log
  178. /u01/app/oracle/oradata/rcat/redo01.log
  179. /u01/app/oracle/flash_recovery_area/RCAT/onlinelog/o1_mf_4_d3o7xbf6_.log

  180. SQL> show parameter db_create

  181. NAME                                     TYPE         VALUE
  182. ------------------------------------ ----------- ------------------------------
  183. db_create_file_dest                     string
  184. db_create_online_log_dest_1             string
  185. db_create_online_log_dest_2             string
  186. db_create_online_log_dest_3             string
  187. db_create_online_log_dest_4             string
  188. db_create_online_log_dest_5             string
  189. SQL> alter database add logfile group 5 ('/u01/app/oracle/redo05a.log','/u01/app/oracle/redo05b.log') size 52428800;

  190. Database altered.

  191. SQL> select  member from v$logfile;

  192. MEMBER
  193. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  194. /u01/app/oracle/oradata/rcat/redo03.log
  195. /u01/app/oracle/oradata/rcat/redo02.log
  196. /u01/app/oracle/oradata/rcat/redo01.log
  197. /u01/app/oracle/flash_recovery_area/RCAT/onlinelog/o1_mf_4_d3o7xbf6_.log
  198. /u01/app/oracle/redo05a.log
  199. /u01/app/oracle/redo05b.log

  200. 6 rows selected.

  201. SQL> show parameter control

  202. NAME                                     TYPE         VALUE
  203. ------------------------------------ ----------- ------------------------------
  204. control_file_record_keep_time             integer         7
  205. control_files                             string         /u01/app/oracle/oradata/rcat/c
  206.                                                  ontrol01.ctl, /u01/app/oracle/
  207.                                                  flash_recovery_area/rcat/contr
  208.                                                  ol02.ctl
  209. control_management_pack_access             string         DIAGNOSTIC+TUNING
  210. SQL> alter system set control_files='/u01/app/oracle/oradata/rcat/control01.ctl','/u01/app/oracle/flash_recovery_area/rcat/control02.ctl','/u01/app/oracle/control03.ctl'  ;
  211. alter system set control_files='/u01/app/oracle/oradata/rcat/control01.ctl','/u01/app/oracle/flash_recovery_area/rcat/control02.ctl','/u01/app/oracle/control03.ctl'
  212.                  *
  213. ERROR at line 1:
  214. ORA-02095: specified initialization parameter cannot be modified


  215. SQL> alter system set control_files='/u01/app/oracle/oradata/rcat/control01.ctl','/u01/app/oracle/flash_recovery_area/rcat/control02.ctl','/u01/app/oracle/control03.ctl'  scope=spfile;

  216. System altered.

  217. SQL> shutdown abort
  218. ORACLE instance shut down.
  219. SQL> exit
  220. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
  221. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  222. [oracle@station90 2016_11_27]$ cp /u01/app/oracle/oradata/rcat/control01.ctl   /u01/app/oracle/control03.ctl
  223. [oracle@station90 2016_11_27]$ sqlplus /nolog

  224. SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 27 17:04:02 2016

  225. Copyright (c) 1982, 2009, Oracle.  All rights reserved.

  226. SQL> conn / as sysdba
  227. Connected to an idle instance.
  228. SQL> startup
  229. ORACLE instance started.

  230. Total System Global Area 1603411968 bytes
  231. Fixed Size                    2213776 bytes
  232. Variable Size                  503318640 bytes
  233. Database Buffers         1090519040 bytes
  234. Redo Buffers                    7360512 bytes
  235. Database mounted.
  236. Database opened.
  237. SQL> show paramter control
  238. SP2-0158: unknown SHOW option "paramter"
  239. SP2-0158: unknown SHOW option "control"
  240. SQL> show parameter control

  241. NAME                                     TYPE         VALUE
  242. ------------------------------------ ----------- ------------------------------
  243. control_file_record_keep_time             integer         7
  244. control_files                             string         /u01/app/oracle/oradata/rcat/c
  245.                                                  ontrol01.ctl, /u01/app/oracle/
  246.                                                  flash_recovery_area/rcat/contr
  247.                                                  ol02.ctl, /u01/app/oracle/cont
  248.                                                  rol03.ctl
  249. control_management_pack_access             string         DIAGNOSTIC+TUNING
  250. SQL> shutdown immediate
  251. Database closed.
  252. Database dismounted.
  253. ORACLE instance shut down.
  254. SQL> exit
  255. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
  256. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  257. [oracle@station90 2016_11_27]$ rm /u01/app/oracle/control03.ctl
  258. [oracle@station90 2016_11_27]$ sqlplus /nolog

  259. SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 27 17:04:59 2016

  260. Copyright (c) 1982, 2009, Oracle.  All rights reserved.

  261. SQL> conn / as sysdba
  262. Connected to an idle instance.
  263. SQL> startup
  264. ORACLE instance started.

  265. Total System Global Area 1603411968 bytes
  266. Fixed Size                    2213776 bytes
  267. Variable Size                  503318640 bytes
  268. Database Buffers         1090519040 bytes
  269. Redo Buffers                    7360512 bytes
  270. ORA-00205: error in identifying control file, check alert log for more info


  271. SQL> exit
  272. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
  273. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  274. [oracle@station90 2016_11_27]$ cp /u01/app/oracle/oradata/rcat/control01.ctl   /u01/app/oracle/control03.ctl
  275. [oracle@station90 2016_11_27]$ sqlplus /nolog

  276. SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 27 17:05:54 2016

  277. Copyright (c) 1982, 2009, Oracle.  All rights reserved.

  278. SQL> conn / as sysdba
  279. Connected.
  280. SQL> alter database mount;

  281. Database altered.

  282. SQL> alter database open ;

  283. Database altered.

  284. SQL> exit
  285. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
  286. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  287. [oracle@station90 2016_11_27]$ cd /u01/app/oracle/
  288. [oracle@station90 oracle]$ ls
  289. admin         cfgtoollogs    control_orcl.ctl     man_recovery_area      product      redo04a.log  redo05b.log
  290. archived_log  checkpoints    diag                 man_recovery_area.11g  redo01c.log  redo04b.log  temp02.dbf
  291. botangdir01   control03.ctl  flash_recovery_area  oradata                redo02c.log  redo05a.log  wallet
  292. [oracle@station90 oracle]$ cd archived_log/
  293. [oracle@station90 archived_log]$ ls
  294. 1_149_816169635.dbf
  295. [oracle@station90 archived_log]$
复制代码

ASM命令:
  1. [root@station90 桌面]# su - oracle
  2. [oracle@station90 ~]$ . oraenv
  3. ORACLE_SID = [orcl] ? +ASM
  4. The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid is /u01/app/oracle
  5. [oracle@station90 ~]$ sqlplus /nolog

  6. SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 27 16:43:27 2016

  7. Copyright (c) 1982, 2009, Oracle.  All rights reserved.

  8. SQL> conn /  as sysdba
  9. Connected.
  10. SQL> desc v$asm_diskgroup
  11. Name                                           Null?    Type
  12. ----------------------------------------- -------- ----------------------------
  13. GROUP_NUMBER                                            NUMBER
  14. NAME                                                    VARCHAR2(30)
  15. SECTOR_SIZE                                            NUMBER
  16. BLOCK_SIZE                                            NUMBER
  17. ALLOCATION_UNIT_SIZE                                    NUMBER
  18. STATE                                                    VARCHAR2(11)
  19. TYPE                                                    VARCHAR2(6)
  20. TOTAL_MB                                            NUMBER
  21. FREE_MB                                            NUMBER
  22. HOT_USED_MB                                            NUMBER
  23. COLD_USED_MB                                            NUMBER
  24. REQUIRED_MIRROR_FREE_MB                            NUMBER
  25. USABLE_FILE_MB                                     NUMBER
  26. OFFLINE_DISKS                                            NUMBER
  27. COMPATIBILITY                                            VARCHAR2(60)
  28. DATABASE_COMPATIBILITY                             VARCHAR2(60)
  29. VOTING_FILES                                            VARCHAR2(1)

  30. SQL> select USABLE_FILE_MB , GROUP_NUMBER  , NAME  from v$asm_diskgroup;

  31. USABLE_FILE_MB GROUP_NUMBER
  32. -------------- ------------
  33. NAME
  34. --------------------------------------------------------------------------------
  35.            426                  1
  36. DATA

  37.            441                  2
  38. FRA


  39. SQL> select USABLE_FILE_MB , TOTAL_MB,    GROUP_NUMBER  , NAME  from v$asm_diskgroup;

  40. USABLE_FILE_MB         TOTAL_MB GROUP_NUMBER
  41. -------------- ---------- ------------
  42. NAME
  43. --------------------------------------------------------------------------------
  44.            426             5784             1
  45. DATA

  46.            441             2892             2
  47. FRA


  48. SQL> select USABLE_FILE_MB , TOTAL_MB,  FREE_MB,     GROUP_NUMBER  , NAME  from v$asm_diskgroup;

  49. USABLE_FILE_MB         TOTAL_MB    FREE_MB GROUP_NUMBER
  50. -------------- ---------- ---------- ------------
  51. NAME
  52. --------------------------------------------------------------------------------
  53.            426             5784        1566                1
  54. DATA

  55.            441             2892         441                2
  56. FRA


  57. SQL> select USABLE_FILE_MB , TOTAL_MB,  FREE_MB,     GROUP_NUMBER  , NAME , TYPE  from v$asm_diskgroup;

  58. USABLE_FILE_MB         TOTAL_MB    FREE_MB GROUP_NUMBER
  59. -------------- ---------- ---------- ------------
  60. NAME
  61. --------------------------------------------------------------------------------
  62. TYPE
  63. ------------------
  64.            426             5784        1566                1
  65. DATA
  66. NORMAL

  67.            441             2892         441                2
  68. FRA
  69. EXTERN

  70. USABLE_FILE_MB         TOTAL_MB    FREE_MB GROUP_NUMBER
  71. -------------- ---------- ---------- ------------
  72. NAME
  73. --------------------------------------------------------------------------------
  74. TYPE
  75. ------------------


  76. SQL> exit
  77. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
  78. With the Automatic Storage Management option
  79. [oracle@station90 ~]$ asmcmd
  80. ASMCMD> ls
  81. DATA/
  82. FRA/
  83. ASMCMD> cd FRA/
  84. ASMCMD> ls
  85. ORCL/
  86. ASMCMD> cd ORCL/
  87. ASMCMD> ls
  88. ARCHIVELOG/
  89. AUTOBACKUP/
  90. CHANGETRACKING/
  91. CONTROLFILE/
  92. ONLINELOG/
  93. ASMCMD> cd CONTROLFILE/
  94. ASMCMD> ls
  95. Current.256.816169633
  96. ASMCMD> cp Current.256.816169633  /u01/app/oracle/control_orcl.ctl
  97. copying +FRA/ORCL/CONTROLFILE/Current.256.816169633 -> /u01/app/oracle/control_orcl.ctl
  98. ASMCMD> cd +DATA
  99. ASMCMD> ls
  100. ASM/
  101. ORCL/
  102. ASMCMD> help
  103.         asmcmd [-vV] [-a <sysasm|sysdba>] [-p] [command]

  104.         The environment variables ORACLE_HOME and ORACLE_SID determine the
  105.         instance to which the program connects, and ASMCMD establishes a
  106.         bequeath connection to it, in the same manner as a SQLPLUS / AS
  107.         SYSASM.  The user must be a member of the OSASM group.

  108.         Specifying the -V option prints the asmcmd version number and
  109.         exits immediately.

  110.         Specifying the -v option prints extra information that can help
  111.         advanced users diagnose problems.

  112.         Specify the -a option to choose the type of connection. There are
  113.         only two possibilities: connecting as SYSASM or as SYSDBA.
  114.         The default value if this option is unspecified is SYSASM.

  115.         Specifying the -p option allows the current directory to be displayed
  116.         in the command prompt, like so:

  117.         ASMCMD [+DATA/ORCL/CONTROLFILE] >

  118.         [command] specifies one of the following commands, along with its
  119.         parameters.

  120.         Type "help [command]" to get help on a specific ASMCMD command.

  121.         commands:
  122.         --------

  123.         md_backup, md_restore

  124.         lsattr, setattr

  125.         cd, cp, du, find, help, ls, lsct, lsdg, lsof, mkalias
  126.         mkdir, pwd, rm, rmalias

  127.         chdg, chkdg, dropdg, iostat, lsdsk, lsod, mkdg, mount
  128.         offline, online, rebal, remap, umount

  129.         dsget, dsset, lsop, shutdown, spbackup, spcopy, spget
  130.         spmove, spset, startup

  131.         chtmpl, lstmpl, mktmpl, rmtmpl

  132.         chgrp, chmod, chown, groups, grpmod, lsgrp, lspwusr, lsusr
  133.         mkgrp, mkusr, orapwusr, passwd, rmgrp, rmusr

  134.         volcreate, voldelete, voldisable, volenable, volinfo
  135.         volresize, volset, volstat

  136. ASMCMD> ls
  137. ASM/
  138. ORCL/
  139. ASMCMD> cd orcl
  140. ASMCMD> ls
  141. CONTROLFILE/
  142. DATAFILE/
  143. ONLINELOG/
  144. PARAMETERFILE/
  145. TEMPFILE/
  146. spfileorcl.ora
  147. ASMCMD> cd ONLINELOG/
  148. ASMCMD> ls
  149. group_1.261.929017499
  150. group_2.262.929017663
  151. group_3.263.929017431
  152. ASMCMD> rm group_3.263.929017431
  153. ORA-15032: not all alterations performed
  154. ORA-15028: ASM file '+DATA/orcl/ONLINELOG/group_3.263.929017431' not dropped; currently being accessed (DBD ERROR: OCIStmtExecute)
  155. ASMCMD>
  156. ASMCMD> ls
  157. group_1.261.929017499
  158. group_2.262.929017663
  159. group_3.263.929017431
  160. ASMCMD> cd ..
  161. ASMCMD> ls
  162. CONTROLFILE/
  163. DATAFILE/
  164. ONLINELOG/
  165. PARAMETERFILE/
  166. TEMPFILE/
  167. spfileorcl.ora
  168. ASMCMD> cd ..
  169. ASMCMD> ls
  170. ASM/
  171. ORCL/
  172. ASMCMD> cd ..
  173. ASMCMD> ls
  174. DATA/
  175. FRA/
  176. ASMCMD> cd FRA
  177. ASMCMD> ls
  178. ORCL/
  179. ASMCMD> cd orcl
  180. ASMCMD> ls
  181. ARCHIVELOG/
  182. AUTOBACKUP/
  183. CHANGETRACKING/
  184. CONTROLFILE/
  185. ONLINELOG/
  186. ASMCMD> cd ARCHIVELOG/
  187. ASMCMD> ls
  188. 2013_12_11/
  189. 2016_11_14/
  190. 2016_11_15/
  191. 2016_11_16/
  192. 2016_11_17/
  193. 2016_11_18/
  194. 2016_11_19/
  195. 2016_11_20/
  196. 2016_11_21/
  197. 2016_11_22/
  198. 2016_11_23/
  199. 2016_11_24/
  200. 2016_11_25/
  201. 2016_11_26/
  202. 2016_11_27/
  203. ASMCMD> ls  
  204. 2016_11_26/
  205. 2016_11_27/
  206. ASMCMD> ls
  207. 2016_11_26/
  208. 2016_11_27/
  209. ASMCMD> ls
  210. 2016_11_26/
  211. 2016_11_27/
  212. ASMCMD> ls
  213. 2016_11_27/
  214. ASMCMD> ls
  215. 2016_11_27/
  216. ASMCMD> ls
  217. 2016_11_27/
  218. ASMCMD> l;s
  219.         commands:
  220.         --------

  221.         md_backup, md_restore

  222.         lsattr, setattr

  223.         cd, cp, du, find, help, ls, lsct, lsdg, lsof, mkalias
  224.         mkdir, pwd, rm, rmalias

  225.         chdg, chkdg, dropdg, iostat, lsdsk, lsod, mkdg, mount
  226.         offline, online, rebal, remap, umount

  227.         dsget, dsset, lsop, shutdown, spbackup, spcopy, spget
  228.         spmove, spset, startup

  229.         chtmpl, lstmpl, mktmpl, rmtmpl

  230.         chgrp, chmod, chown, groups, grpmod, lsgrp, lspwusr, lsusr
  231.         mkgrp, mkusr, orapwusr, passwd, rmgrp, rmusr

  232.         volcreate, voldelete, voldisable, volenable, volinfo
  233.         volresize, volset, volstat

  234. ASMCMD> ls
  235. ASMCMD-08002: entry 'ARCHIVELOG' does not exist in directory '+FRA/orcl/'
  236. ASMCMD> ls
  237. ASMCMD-08002: entry 'ARCHIVELOG' does not exist in directory '+FRA/orcl/'
  238. ASMCMD> ls
  239. 2016_11_27/
  240. ASMCMD> cd ..
  241. ASMCMD> ls
  242. ARCHIVELOG/
  243. AUTOBACKUP/
  244. CHANGETRACKING/
  245. CONTROLFILE/
  246. ONLINELOG/
  247. ASMCMD> pwd
  248. +FRA/orcl
  249. ASMCMD> ls
  250. ARCHIVELOG/
  251. AUTOBACKUP/
  252. CHANGETRACKING/
  253. CONTROLFILE/
  254. ONLINELOG/
  255. ASMCMD> cd ARCHIVELOG/
  256. ASMCMD> ls
  257. 2016_11_27/
  258. ASMCMD> cd 2016_11_27/
  259. ASMCMD> ls
  260. thread_1_seq_141.392.929035007
  261. thread_1_seq_142.390.929035009
  262. thread_1_seq_143.389.929035009
  263. thread_1_seq_144.388.929035009
  264. thread_1_seq_145.387.929035065
  265. thread_1_seq_146.386.929035073
  266. thread_1_seq_147.385.929035077
  267. thread_1_seq_148.384.929035193
  268. ASMCMD> ls
  269. thread_1_seq_141.392.929035007
  270. thread_1_seq_142.390.929035009
  271. thread_1_seq_143.389.929035009
  272. thread_1_seq_144.388.929035009
  273. thread_1_seq_145.387.929035065
  274. thread_1_seq_146.386.929035073
  275. thread_1_seq_147.385.929035077
  276. thread_1_seq_148.384.929035193
  277. thread_1_seq_149.382.929037395
  278. ASMCMD>
复制代码

第二路归档:
  1. NAME                                     TYPE         VALUE
  2. ------------------------------------ ----------- ------------------------------
  3. log_archive_duplex_dest              string
  4. SQL> alter system set log_archive_dest_1='location=use_db_recovery_file_dest';

  5. System altered.

  6. SQL> alter system set log_archive_dest_2='location=/u01/app/oracle/archived_log';

  7. System altered.

  8. SQL> alter system archive log current ;

  9. System altered.

  10. SQL>
复制代码



回复

使用道具 举报

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

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-4-27 04:42 , Processed in 0.037437 second(s), 24 queries .

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