更改Oracle数据库的SID

1.查看数据库当前设置

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE 9.2.0.1.0 Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production

[@more@] SQL> show parameter name

NAME TYPE VALUE
------------------------------------ ----------- -------------------
db_file_name_convert string
db_name string eyglev
global_names boolean FALSE
instance_name string eyglev
lock_name_space string
log_file_name_convert string
oracle_trace_collection_name string
oracle_trace_facility_name string oracled
plsql_native_make_file_name string
service_names string eyglev


2.Shutdown数据库

SQL> connect sys/orasys as sysdba

Connected.

SQL> shutdown immediate

Database closed.
Database dismounted.
ORACLE instance shut down.


3.Startup mount

SQL> startup mount

ORACLE instance started.
Total System Global Area 135338868 bytes
Fixed Size 453492 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
Database mounted.

4. 使用NID更改

SQL> host

Microsoft Windows 2000 [Version 5.00.2195]
(C) 版权所有 1985-2000 Microsoft Corp.

C:>nid target=sys/orasys dbname=eyglen
DBNEWID: Release 9.2.0.1.0 – Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
Connected to database EYGLEV (DBID=677189177)
Control Files in database:
E:ORACLEORADATAEYGLENCONTROL01.CTL
E:ORACLEORADATAEYGLENCONTROL02.CTL
E:ORACLEORADATAEYGLENCONTROL03.CTL
Change database ID and database name EYGLEV to EYGLEN? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 677189177 to 3955758099
Changing database name from EYGLEV to EYGLEN
Control File E:ORACLEORADATAEYGLENCONTROL01.CTL – modified
Control File E:ORACLEORADATAEYGLENCONTROL02.CTL – modified
Control File E:ORACLEORADATAEYGLENCONTROL03.CTL – modified
Datafile E:ORACLEORADATAEYGLENSYSTEM01.DBF - dbid changed, ...
Datafile E:ORACLEORADATAEYGLENUNDOTBS01.DBF - dbid changed, ...
Datafile E:ORACLEORADATAEYGLENCWMLITE01.DBF - dbid changed, ...
Datafile E:ORACLEORADATAEYGLENDRSYS01.DBF - dbid changed, ...
Datafile E:ORACLEORADATAEYGLENINDX01.DBF - dbid changed, ...
Datafile E:ORACLEORADATAEYGLENODM01.DBF - dbid changed, ...
Datafile E:ORACLEORADATAEYGLENTOOLS01.DBF - dbid changed, ...
Datafile E:ORACLEORADATAEYGLENUSERS01.DBF - dbid changed, ...
Datafile E:ORACLEORADATAEYGLENXDB01.DBF - dbid changed, ...
Datafile E:ORACLEORADATAEYGLENEYGLE.DBF - dbid changed, ...
Datafile E:ORACLEORADATAEYGLENTEMP01.DBF - dbid changed, ...
Control File E:ORACLEORADATAEYGLENCONTROL01.CTL - dbid changed, ...
Control File E:ORACLEORADATAEYGLENCONTROL02.CTL - dbid changed, ...
Control File E:ORACLEORADATAEYGLENCONTROL03.CTL - dbid changed, ...
Database name changed to EYGLEN.
Modify parameter file and generate a new password file before restarting.
Database ID for database EYGLEN changed to 3955758099.
All previous backups and archived redo logs for this database are ...
Shut down database and open with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.

5.Shutdown database

SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.


6.修改初始化参数文件、spfile文件(init.ora/spfile.ora)

###########################################
instance_name=eyglen
#instance_name=eyglev
###########################################
db_domain=""
db_name=eyglen
# db_name=eyglev
###########################################


7.重建spfile文件

如果你没有使用spfile,当然无需重建,跳至8
SQL> startup pfile=E:Oracleadmineyglenpfileinit.ora

ORACLE instance started.
Total System Global Area 135338868 bytes
Fixed Size 453492 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
ORA-01991: invalid password file 'e:oracle...PWDeyglen.ORA'

SQL> CREATE SPFILE='E:OracleOra9iR2databaseSPFILEEYGLEN.ORA' FROM
2 PFILE='E:Oracleadmineyglenpfileinit.ora';

File created.


8.重建口令文件

SQL> host
Microsoft Windows 2000 [Version 5.00.2195]
(C) 版权所有 1985-2000 Microsoft Corp.

C:>orapwd file=E:Oracle...PWDeyglen.ORA password=oracle entries=5


9.shutdown数据库

如果不使用spfile,则可以跳至10
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.


10.Startup mount,resetlogs打开

SQL> startup mount
ORACLE instance started.
Total System Global Area 135338868 bytes
Fixed Size 453492 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
Database mounted.

SQL> alter database open resetlogs
2 /

Database altered.


11.修改后的参数

SQL> show parameter name

NAME TYPE VALUE
------------------------------------ ----------- ------------------
db_file_name_convert string
db_name string eyglen
global_names boolean FALSE
instance_name string eyglen
lock_name_space string
log_file_name_convert string
oracle_trace_collection_name string
oracle_trace_facility_name string oracled
plsql_native_make_file_name string
service_names string eyglen

12.对数据库做个全备份

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7319461/viewspace-928323/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/7319461/viewspace-928323/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值