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
原文地址:https://www.cnblogs.com/hftian/p/9060665.html
时间: 2024-10-03 14:38:31