Документ создан: 29.03.2019

Перемещение/переименование файла данных.

С помощью RMAN

Было:

SQL> SELECT file_id, file_name FROM dba_data_files WHERE tablespace_name='T2';
 
FILE_ID FILE_NAME
------- ----------------------------------------------------------------------
      9 /u01/app/oracle/oradata/XE/t2_01.dbf
 
1 row selected.

Выполнили:

run {
    backup datafile 9;
    sql "alter database datafile 9 offline";
    SET newname FOR datafile 9 TO '/u01/app/oracle/oradata/XE/tbs_t2_01.dbf';
    restore datafile 9;
    switch datafile ALL;
    recover datafile 9;
    sql "alter database datafile 9 online";
}

Стало:

SQL> SELECT file_id, file_name FROM dba_data_files WHERE tablespace_name='T2';
 
FILE_ID FILE_NAME
------- ----------------------------------------------------------------------
      9 /u01/app/oracle/oradata/XE/tbs_t2_01.dbf
 
1 row selected.

Без использования RMAN.

Было:

SQL> SELECT file_id, file_name FROM dba_data_files WHERE tablespace_name='T2';
 
        FILE_ID FILE_NAME
--------------- ----------------------------------------------------------------------
              9 /u01/app/oracle/oradata/XE/tbs_t2_01.dbf
 
1 row selected.

Выполнили:

SQL> ALTER tablespace t2 offline immediate;

в операционной системе:

mv /u01/app/oracle/oradata/XE/tbs_t2_01.dbf /u01/app/oracle/oradata/XE/t2_01.dbf

снова в sqlplus:

SQL> ALTER tablespace t2 RENAME datafile '/u01/app/oracle/oradata/XE/tbs_t2_01.dbf' TO '/u01/app/oracle/oradata/XE/t2_01.dbf';
 
Tablespace altered.
SQL> recover tablespace t2;
Media recovery complete.
SQL> ALTER tablespace t2 online;
 
Tablespace altered.

Стало:

SQL>select file_id, file_name FROM dba_data_files WHERE tablespace_name='T2';
 
        FILE_ID FILE_NAME
--------------- ----------------------------------------------------------------------
              9 /u01/app/oracle/oradata/XE/t2_01.dbf
 
1 row selected.
 
Top.Mail.Ru
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki Donate