更改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
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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle - 資料庫名、例項名、服務名、ORACLE_SID 的說明和區別Oracle資料庫
- Postgresql10資料庫之更改資料庫的名稱SQL資料庫
- Oracle資料庫-----資料庫的基本概念Oracle資料庫
- MySQL 更改資料庫資料儲存目錄MySql資料庫
- oracle 更改分割槽表資料 ora-14402Oracle
- 「Oracle」Oracle 資料庫安裝Oracle資料庫
- oracle資料庫的impdp,expdpOracle資料庫
- oracle資料庫%notfound的理解Oracle資料庫
- Oracle資料庫配置Oracle資料庫
- oracle資料庫與oracle例項Oracle資料庫
- 「Oracle」Oracle資料庫基本概念Oracle資料庫
- 「Oracle」Oracle 資料庫基本概念Oracle資料庫
- oracle 備份資料庫,匯出資料庫Oracle資料庫
- oracle rac資料庫的安裝Oracle資料庫
- oracle資料庫的配置檔案Oracle資料庫
- Oracle資料庫中遇到的坑Oracle資料庫
- Oracle 資料庫的眾多 “NAME”Oracle資料庫
- 【資料庫資料恢復】如何恢復Oracle資料庫truncate表的資料資料庫資料恢復Oracle
- Ubuntu 上更改 MySQL 資料庫資料儲存目錄UbuntuMySql資料庫
- DataX將MySql資料庫資料同步到Oracle資料庫MySql資料庫Oracle
- 4.2. Oracle資料庫Oracle資料庫
- Laravel 使用 Oracle 資料庫LaravelOracle資料庫
- oracle資料庫卡頓Oracle資料庫
- Oracle資料庫閃回Oracle資料庫
- oracle資料庫資料字典應用Oracle資料庫
- sqlserver讀取oracle資料庫資料SQLServerOracle資料庫
- 配置ORACLE資料庫到達夢資料庫的異構DBLINKOracle資料庫
- 【資料庫資料恢復】Oracle資料庫誤truncate table的資料恢復案例資料庫資料恢復Oracle
- 【資料庫資料恢復】誤truncate table的Oracle資料庫資料恢復方案資料庫資料恢復Oracle
- Oracle資料庫遷移至PolarDb(阿里雲資料庫)Oracle資料庫阿里
- 「Oracle」Oracle 資料庫備份還原Oracle資料庫
- Django中更改預設資料庫為mysqlDjango資料庫MySql
- Linux CentOS更改MySQL資料庫目錄位置LinuxCentOSMySql資料庫
- [Oracle]Oracle資料庫資料被修改或者刪除恢復資料Oracle資料庫
- DataX將Oracle資料庫資料同步到達夢資料庫Oracle資料庫
- Oracle - 資料庫的組成簡介Oracle資料庫
- 12、Oracle中的其它資料庫物件Oracle資料庫物件
- oracle Mysql PostgreSQL 資料庫的對比OracleMySql資料庫
- Oracle資料庫的查詢變慢了Oracle資料庫