Oracle学习(十四)之users表空间数据文件管理

1.查寻文件所在位置

SQL> select FILE_ID,TABLESPACE_NAME,file_name from dba_data_files;

    FILE_ID TABLESPACE_NAME FILE_NAME
------- --------------- -------------------------------------------
          5 EXAMPLE         /u01/app/oracle/oradata/orcl/example01.dbf
      4 USERS           /u01/app/oracle/oradata/orcl/users01.dbf
          3 UNDOTBS1        /u01/app/oracle/oradata/orcl/undotbs01.dbf
      2 SYSAUX          /u01/app/oracle/oradata/orcl/sysaux01.dbf
          1 SYSTEM          /u01/app/oracle/oradata/orcl/system01.dbf

2.设置users表空间离线

SQL> alter tablespace users offline;

Tablespace altered.

3.将数据文件移动到指定位置(这里指定/u03/ora11g/data下)

SQL> host mv /u01/app/oracle/oradata/orcl/users01.dbf /u03/ora11g/data

SQL> host ls -l /u03/ora11g/data
total 5140
-rwxrwxrwx 1 oracle oinstall 5251072 Jun  2 22:03 users01.dbf

4.改变数据库users表空间参数

SQL> alter tablespace users
  2  rename datafile'/u01/app/oracle/oradata/orcl/users01.dbf'
  3  to '/u03/ora11g/data/users01.dbf';

Tablespace altered.

5.设置users表空间在线

SQL> alter tablespace users online;

Tablespace altered.

6.查询参数

SQL> select FILE_ID,TABLESPACE_NAME,file_name from dba_data_files;

   FILE_ID TABLESPACE_NAME      FILE_NAME
---------- -------------------- ---------------------------------------------
         5 EXAMPLE              /u01/app/oracle/oradata/orcl/example01.dbf
         4 USERS                /u03/ora11g/data/users01.dbf
         3 UNDOTBS1             /u01/app/oracle/oradata/orcl/undotbs01.dbf
         2 SYSAUX               /u01/app/oracle/oradata/orcl/sysaux01.dbf
         1 SYSTEM               /u01/app/oracle/oradata/orcl/system01.dbf

你可能感兴趣的:(Oracle数据库学习)