瘋狂

          STANDING ON THE SHOULDERS OF GIANTS
          posts - 481, comments - 486, trackbacks - 0, articles - 1
            BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          Oracle 更改表空間位置的具體步驟

          Posted on 2011-05-17 10:13 瘋狂 閱讀(1843) 評(píng)論(0)  編輯  收藏 所屬分類: database

          [oracle]> sqlplus /nolog
          SQL*Plus: Release 10.2.0.1.0 – Production on Tue Aug 19 03:46:29 2008
          Copyright (c) 1982, 2005, Oracle. All rights reserved.
          SQL> conn /as sysdba
          Connected.
          SQL> shutdown immediate
          ORA-01109: database not open
          Database dismounted.
          ORACLE instance shut down.
          SQL> startup
          ORACLE instance started.
          Total System Global Area 167772160 bytes
          Fixed Size 1977208 bytes
          Variable Size 104862856 bytes
          Database Buffers 58720256 bytes
          Redo Buffers 2211840 bytes
          Database mounted.
          Database opened.
          SQL> alter tablespace users offline;
          Tablespace altered.
          SQL> host mv /opt/oracle/oradata/ora10g/users01.dbf /opt/oracle/oradata_bak/
          SQL> exit
          Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – 64bit Production
          With the Partitioning, OLAP and Data Mining options
          [oracle]> ls
          control01.ctl control03.ctl redo01.log redo03.log system01.dbf undotbs01.dbf
          control02.ctl example01.dbf redo02.log sysaux01.dbf temp01.dbf users01.dbf
          [oracle]> mv /opt/oracle/oradata/ora10g/users01.dbf /opt/oracle/oradata_bak/
          [oracle]> sqlplus /nolog
          SQL*Plus: Release 10.2.0.1.0 – Production on Tue Aug 19 03:52:19 2008
          Copyright (c) 1982, 2005, Oracle. All rights reserved.
          SQL> conn /as sysdba
          Connected.
          SQL> alter tablespace users
          2 rename datafile ‘/opt/oracle/oradata/ora10g/users01.dbf’ to ‘/opt/oracle/oradata_bak/users01.dbf’;
          Tablespace altered.
          SQL> alter tablespace users online;
          Tablespace altered.
          見(jiàn)效果
          =============================================
          RMAN> report schema
          2> ;
          Report of database schema
          List of Permanent Datafiles
          ===========================
          File Size(MB) Tablespace RB segs Datafile Name
          —- ——– ——————– ——- ————————
          1 480 SYSTEM *** /opt/oracle/oradata/ora10g/system01.dbf
          2 30 UNDOTBS1 *** /opt/oracle/oradata/ora10g/undotbs01.dbf
          3 240 SYSAUX *** /opt/oracle/oradata/ora10g/sysaux01.dbf
          4 5 USERS *** /opt/oracle/oradata_bak/users01.dbf
          5 100 EXAMPLE *** /opt/oracle/oradata/ora10g/example01.dbf
          List of Temporary Files
          =======================
          File Size(MB) Tablespace Maxsize(MB) Tempfile Name
          —- ——– ——————– ———– ——————–
          1 22 TEMP 32767 /opt/oracle/oradata/ora10g/temp01.dbf
          恢復(fù)回去…
          [oracle]> pwd
          /opt/oracle/oradata/ora10g
          [oracle]> mv /opt/oracle/oradata_bak/users01.dbf .
          [oracle]> ls
          control01.ctl control03.ctl redo01.log redo03.log system01.dbf undotbs01.dbf
          control02.ctl example01.dbf redo02.log sysaux01.dbf temp01.dbf users01.dbf
          [oracle]> sqlplus /nolog
          SQL*Plus: Release 10.2.0.1.0 – Production on Tue Aug 19 04:07:47 2008
          Copyright (c) 1982, 2005, Oracle. All rights reserved.
          SQL> conn /as sysdba
          Connected.
          SQL> alter tablespace users rename datafile ‘/opt/oracle/oradata_bak/users01.dbf’ to ‘/opt/oracle/oradata/ora10g/users01.dbf’;
          Tablespace altered.
          SQL> alter tablespace users online;
          Tablespace altered.
          效果如下
          RMAN> report schema;
          Report of database schema
          List of Permanent Datafiles
          ===========================
          File Size(MB) Tablespace RB segs Datafile Name
          —- ——– ——————– ——- ————————
          1 480 SYSTEM *** /opt/oracle/oradata/ora10g/system01.dbf
          2 30 UNDOTBS1 *** /opt/oracle/oradata/ora10g/undotbs01.dbf
          3 240 SYSAUX *** /opt/oracle/oradata/ora10g/sysaux01.dbf
          4 5 USERS *** /opt/oracle/oradata/ora10g/users01.dbf
          5 100 EXAMPLE *** /opt/oracle/oradata/ora10g/example01.dbf
          List of Temporary Files
          =======================
          File Size(MB) Tablespace Maxsize(MB) Tempfile Name
          —- ——– ——————– ———– ——————–
          1 22 TEMP 32767 /opt/oracle/oradata/ora10g/temp01.dbf

           

          本文來(lái)自CSDN博客,轉(zhuǎn)載請(qǐng)標(biāo)明出處:http://blog.csdn.net/star33375249/archive/2009/10/26/4728635.aspx

          主站蜘蛛池模板: 延津县| 浦江县| 沙洋县| 齐齐哈尔市| 宜君县| 东乌珠穆沁旗| 江川县| 扎赉特旗| 平阳县| 石景山区| 呼伦贝尔市| 仙居县| 深州市| 中阳县| 文化| 余庆县| 桐乡市| 南郑县| 临澧县| 永吉县| 鄯善县| 梁山县| 鄂托克前旗| 美姑县| 项城市| 疏附县| 通化县| 济源市| 东安县| 北宁市| 通榆县| 邹平县| 武穴市| 富蕴县| 凤阳县| 乌兰浩特市| 宜兴市| 浮山县| 新巴尔虎左旗| 青冈县| 绥芬河市|