Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify the db_name,instace_name,sid_name of oracle database

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to modify the db_name,instace_name,sid_name of the oracle database, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Concept: db_name is recorded in data files, log files and control files, which can be different from instance_name.

Sid_name 1. Mainly distinguishing the connected database

two。 Make a distinction at the operating system level. When an Oracle instance starts, the process of fork on the operating system must use this SID to distinguish the instance from other instances. The background process uses this sid to represent the database eg: ps-ef | grep smon

3.instance_name is an important parameter in a database, and multiple databases with the same instance_name can be found in a host.

The instance of Oracle (instance) consists of a shared memory area (SGA) and a set of background processes (background processes), which are the channels through which the database and the operating system interact, and the names of these processes are determined by ORACLE_SID.

Database name db_name > instance name instance_name > oracle_sid

Modify instance name

Original instance name

SQL > select dbid,name from v$database

DBID NAME

--

1475786014 ORCL

SQL > select instance from v$thread

INSTANCE

Orcl

Modification process:

SQL > shu immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

[root@node ~] # vi / etc/oratab

Test:/u01/app/oracle/product/11.2.0/db_1:N

[oracle@node ~] $vi .bash _ profile

Export ORACLE_SID=test

[oracle@node ~] $source .bash _ profile

[oracle@node ~] $env | grep ORA

ORACLE_SID=test

ORACLE_BASE=/u01/app/oracle

ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1

[oracle@node ~] $cd $ORACLE_HOME/dbs

[oracle@node dbs] $ll

Total 9544

-rw-rw----. 1 oracle oinstall 1544 Jun 30 21:04 hc_orcl.dat

-rw-r--r--. 1 oracle oinstall 2851 May 15 2009 init.ora

-rw-r--r--. 1 oracle oinstall 935 Jun 30 18:04 initorcl.ora

-rw-r-. 1 oracle oinstall 24 Jun 30 06:47 lkORCL

-rw-r-. 1 oracle oinstall 1536 Jun 30 06:50 orapworcl

-rw-r-. 1 oracle oinstall 9748480 Jun 30 18:05 snapcf_orcl.f

-rw-r-. 1 oracle oinstall 2560 Jun 30 13:09 spfileorcl.ora

[oracle@node dbs] $mv initorcl.ora inittest.ora

[oracle@node dbs] $mv hc_orcl.dat hc_test.dat

[oracle@node dbs] $mv lkORCL lkTEST

[oracle@node dbs] $mv snapcf_orcl.f snapcf_test.f

[oracle@node dbs] $mv spfileorcl.ora spfiletest.ora

[oracle@node dbs] $rm-rf orapworcl

[oracle@node dbs] $orapwd file=orapwtest password=system

SQL > startup

ORACLE instance started.

Total System Global Area 1152450560 bytes

Fixed Size 2252584 bytes

Variable Size 738197720 bytes

Database Buffers 402653184 bytes

Redo Buffers 9347072 bytes

Database mounted.

Database opened.

SQL > select instance_name,status from v$instance

INSTANCE_NAME STATUS

--

Test OPEN

SQL > select instance from v$thread

INSTANCE

Test

SQL > select dbid,name from v$database

DBID NAME

--

1475786014 ORCL

Modify database name

Backup control file

SQL > alter database backup controlfile to trace

Database altered.

More / u01/app/oracle/diag/rdbms/orcl/test/trace/test_ora_119661.trc

The modification is as follows

CREATE CONTROLFILE set DATABASE "TEST" RESETLOGS noARCHIVELOG

MAXLOGFILES 16

MAXLOGMEMBERS 3

MAXDATAFILES 100

MAXINSTANCES 8

MAXLOGHISTORY 292

LOGFILE

GROUP 1'/ oradata/test/redo01.log' SIZE 50m BLOCKSIZE 512

GROUP 2'/ oradata/test/redo02.log' SIZE 50m BLOCKSIZE 512

GROUP 3'/ oradata/test/redo03.log' SIZE 50m BLOCKSIZE 512

-- STANDBY LOGFILE

DATAFILE

'/ oradata/test/system01.dbf'

'/ oradata/test/sysaux01.dbf'

'/ oradata/test/undotbs01.dbf'

'/ oradata/test/users01.dbf'

'/ oradata/test/fan.dbf'

CHARACTER SET AL32UTF8

(find all orcl changed to test, all ORCL changed to test, find CREATE CONTROLFILE REUSE DATABASE... Statement to change the REUSE to SET

SQL > shu immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL > create pfile from spfile

Modify inittest.ora

* .audit_file_dest='/u01/app/oracle/admin/test/adump'

* .audit_trail='NONE'

* .compatible='11.2.0.4.0'

* .control_files='/oradata/test/control01.ctl'

* .db_block_size=8192

* .db_domain=''

* .db_name='test'

* .db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'

* .db_recovery_file_dest_size=4385144832

* .diagnostic_dest='/u01/app/oracle'

* .dispatchers=' (PROTOCOL=TCP) (SERVICE=testXDB)'

* .log_archive_format='%t_%s_%r.dbf'

* .memory_target=1150287872

* .open_cursors=300

* .processes=150

* .remote_login_passwordfile='EXCLUSIVE'

* .undo_tablespace='UNDOTBS1'

Change catalog

/ u01/app/oracle/admin/orcl/adump

/ oradata/orcl/

Change orcl to test (the directory in the control file is consistent with the operating system)

Sql > create spfile from pfile

Sql > startup nomount

Sql >

SQL > CREATE CONTROLFILE set DATABASE "TEST" RESETLOGS noARCHIVELOG

2 MAXLOGFILES 16

3 MAXLOGMEMBERS 3

4 MAXDATAFILES 100

5 MAXINSTANCES 8

6 MAXLOGHISTORY 292

7 LOGFILE

8 GROUP 1'/ oradata/test/redo01.log' SIZE 50m BLOCKSIZE 512

9 GROUP 2'/ oradata/test/redo02.log' SIZE 50m BLOCKSIZE 512

10 GROUP 3'/ oradata/test/redo03.log' SIZE 50m BLOCKSIZE 512

11-- STANDBY LOGFILE

12 DATAFILE

13'/ oradata/test/system01.dbf'

14'/ oradata/test/sysaux01.dbf'

15'/ oradata/test/undotbs01.dbf'

16'/ oradata/test/users01.dbf'

17'/ oradata/test/fan.dbf'

18 CHARACTER SET AL32UTF8

19

Control file created.

SQL > alter database open resetlogs

Database altered.

SQL > select dbid,name from v$database

DBID NAME

--

1475786014 TEST

SQL > select instance from v$thread

INSTANCE

Test

SQL > select instance_name,status from v$instance

INSTANCE_NAME STATUS

--

Test OPEN

Thank you for reading this article carefully. I hope the article "how to modify the db_name,instace_name,sid_name of oracle database" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report