Maison > base de données > tutoriel mysql > Oracle rename数据文件的两种方法

Oracle rename数据文件的两种方法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Libérer: 2016-06-07 17:25:48
original
1540 Les gens l'ont consulté

Oracle rename数据文件的两种方法 备注:红色为原路径 紫色为目标路径 第一种 alter tablespace users rename datafile

Oracle rename数据文件的两种方法

备注:红色为原路径 紫色为目标路径

第一种

alter tablespace users rename datafile '==' to ‘***';

这种方式需要数据库处于open状态,,表空间在offline的状态下才能更改。

SQL> alter tablespace users rename datafile '/opt/ora10g/oradata/orcl/user0100.dbf','/opt/ora10g/oradata/orcl/user099.dbf' to '/opt/ora10g/oradata/orcl/userrename1.dbf','/opt/ora10g/oradata/orcl/userrename2.dbf';
alter tablespace users rename datafile '/opt/ora10g/oradata/orcl/user0100.dbf','/opt/ora10g/oradata/orcl/user099.dbf' to '/opt/ora10g/oradata/orcl/userrename1.dbf','/opt/ora10g/oradata/orcl/userrename2.dbf'
*
ERROR at line 1:
ORA-01525: error in renaming data files
ORA-01121: cannot rename database file 107 - file is in use or recovery
ORA-01110: data file 107: '/opt/ora10g/oradata/orcl/user0100.dbf'

SQL> alter tablespace users offline;
Tablespace altered.

SQL> alter tablespace users rename datafile '/opt/ora10g/oradata/orcl/user0100.dbf','/opt/ora10g/oradata/orcl/user099.dbf' to '/opt/ora10g/oradata/orcl/userrename1.dbf','/opt/ora10g/oradata/orcl/userrename2.dbf';
alter tablespace users rename datafile '/opt/ora10g/oradata/orcl/user0100.dbf','/opt/ora10g/oradata/orcl/user099.dbf' to '/opt/ora10g/oradata/orcl/userrename1.dbf','/opt/ora10g/oradata/orcl/userrename2.dbf'
*
ERROR at line 1:
ORA-01525: error in renaming data files
ORA-01141: error renaming data file 107 - new file '/opt/ora10g/oradata/orcl/userrename1.dbf' not found
ORA-01110: data file 107: '/opt/ora10g/oradata/orcl/user0100.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

SQL> !
[oracle@rac1 ~]$ cp /opt/ora10g/oradata/orcl/user0100.dbf /opt/ora10g/oradata/orcl/userrename1.dbf[oracle@rac1 ~]$ cp /opt/ora10g/oradata/orcl/user099.dbf /opt/ora10g/oradata/orc
l/userrename2.dbf
[oracle@rac1 ~]$ exit
exit

SQL> alter tablespace users rename datafile '/opt/ora10g/oradata/orcl/user0100.dbf','/opt/ora10g/oradata/orcl/user099.dbf' to '/opt/ora10g/oradata/orcl/userrename1.dbf','/opt/ora10g/oradata/orcl/userrename2.dbf';
Tablespace altered.

SQL> alter tablespace users online;
Tablespace altered.

linux

Étiquettes associées:
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal