Oracle数据文件改名
Posted hftian
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle数据文件改名相关的知识,希望对你有一定的参考价值。
1. open状态改名
SYS@userdata>select tablespace_name,file#,file_name,v.status,v.enabled from dba_data_files d,v$datafile v where d.file_id=v.file#;
TABLESPACE_NAME FILE# FILE_NAME STATUS ENABLED
-------------------- ---------- ------------------------------------------------------------ --------------------- ------------------------------
SYSTEM 1 /u01/app/oracle/oradata/userdata/system01.dbf SYSTEM READ WRITE
UNDOTBS1 2 /u01/app/oracle/oradata/userdata/undotbs01.dbf ONLINE READ WRITE
SYSAUX 3 /u01/app/oracle/oradata/userdata/sysaux01.dbf ONLINE READ WRITE
USERS 4 /u01/app/oracle/oradata/userdata/users01.dbf ONLINE READ WRITE
EXAMPLE 5 /u01/app/oracle/oradata/userdata/example01.dbf ONLINE READ WRITE
SYS@userdata>
SYS@userdata>alter tablespace users offline;
Tablespace altered.
SYS@userdata>host cp /u01/app/oracle/oradata/userdata/users01.dbf /u01/app/oracle/oradata/userdata/users02.dbf
SYS@userdata>alter database rename file ‘/u01/app/oracle/oradata/userdata/users01.dbf‘ to ‘/u01/app/oracle/oradata/userdata/users02.dbf‘;
Database altered.
SYS@userdata>alter tablespace users online;
Tablespace altered.
SYS@userdata>select tablespace_name,file#,file_name,v.status,v.enabled from dba_data_files d,v$datafile v where d.file_id=v.file#;
TABLESPACE_NAME FILE# FILE_NAME STATUS ENABLED
-------------------- ---------- ------------------------------------------------------------ --------------------- ------------------------------
SYSTEM 1 /u01/app/oracle/oradata/userdata/system01.dbf SYSTEM READ WRITE
UNDOTBS1 2 /u01/app/oracle/oradata/userdata/undotbs01.dbf ONLINE READ WRITE
SYSAUX 3 /u01/app/oracle/oradata/userdata/sysaux01.dbf ONLINE READ WRITE
USERS 4 /u01/app/oracle/oradata/userdata/users02.dbf ONLINE READ WRITE
EXAMPLE 5 /u01/app/oracle/oradata/userdata/example01.dbf ONLINE READ WRITE
2. mount状态改名
SYS@userdata>select open_mode from v$database;
OPEN_MODE
------------------------------
MOUNTED
SYS@userdata>host cp /u01/app/oracle/oradata/userdata/users02.dbf /u01/app/oracle/oradata/userdata/users01.dbf
SYS@userdata>alter database rename file ‘/u01/app/oracle/oradata/userdata/users02.dbf‘ to ‘/u01/app/oracle/oradata/userdata/users01.dbf‘;
Database altered.
SYS@userdata>alter database open;
Database altered.
SYS@userdata>select tablespace_name,file#,file_name,v.status,v.enabled from dba_data_files d,v$datafile v where d.file_id=v.file#;
TABLESPACE_NAME FILE# FILE_NAME STATUS ENABLED
-------------------- ---------- ------------------------------------------------------------ --------------------- ------------------------------
SYSTEM 1 /u01/app/oracle/oradata/userdata/system01.dbf SYSTEM READ WRITE
UNDOTBS1 2 /u01/app/oracle/oradata/userdata/undotbs01.dbf ONLINE READ WRITE
SYSAUX 3 /u01/app/oracle/oradata/userdata/sysaux01.dbf ONLINE READ WRITE
USERS 4 /u01/app/oracle/oradata/userdata/users01.dbf ONLINE READ WRITE
EXAMPLE 5 /u01/app/oracle/oradata/userdata/example01.dbf ONLINE READ WRITE
以上是关于Oracle数据文件改名的主要内容,如果未能解决你的问题,请参考以下文章
Oracle 数据库 - 使用UEStudio修改dmp文件版本号,解决imp命令恢复的数据库与dmp本地文件版本号不匹配导致的导入失败问题,“ORACLE error 12547”问题处理(代码片段
数据库open状态下,如何修改数据文件路径(可用于改名改路径)