oracle 备份恢复 sid修改

查看dbid和dbname

 

 检查参数

[oracle10g@oracletest2 ~]$ echo $ORACLE_SID
orcl10gtest
View Code

 

SQL> 
SQL> show parameter db_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      orcl10gt
SQL> 
SQL> 
SQL> show parameter service_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      orcl10gtest
SQL> 
SQL> 
SQL> 
SQL> show parameter instance_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      orcl10gtest
SQL> 
SQL> select dbid,name from v$database;

      DBID NAME
---------- ---------
 880224647 ORCL10GT

SQL> 
SQL> 
View Code
$ lsnrctl status
View Code

 

 

启动到mount状态 

SQL> shutdown immediate
SQL> startup mount

nid工具

$ nid -help

修改控制文件和数据文件中的dbname

nid TARGET=sys/abc1234 DBNAME=ORCL10 LOGFILE=nid.log 

修改spfile中的dbname

SQL> startup nomount

SQL> show parameter db_name

    NAME TYPE VALUE
    ------------------------------------ ----------- ------------------------------
    db_name string orcl10gt
SQL>
SQL>
SQL> alter system set db_name=orcl10 scope=spfile;

System altered.

重启

SQL> shutdown immediate
ORA-01507: database not mounted


ORACLE instance shut down.
SQL>
SQL> startup mount

SQL> show parameter db_name

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string ORCL10
SQL>

open

SQL>
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SQL> alter database open resetlogs;

Database altered.

SQL>

 注意:以resetlogs模式打开数据库之后需要立即执行全库备份。

查看db_name 和dbid发生变化

SQL> show parameter db_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      ORCL10
SQL> 

SQL> select dbid,name from v$database;

      DBID NAME
---------- ---------
4190373315 ORCL10
View Code

 

posted @ 2018-09-04 15:55  EngineTang  阅读(176)  评论(0编辑  收藏  举报