Oracle NID modifies DBName

Source: Internet
Author: User
Tags reserved

The purpose of modifying name is only to manage it clearly and not to repeat it in the future. I am lazy, memory is poor, so I put down
1. Check the current name
Sql> Show Parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
Db_file_name_convert string
Db_name string test141
Db_unique_name string test141
Global_names Boolean FALSE
instance_name string test141
Lock_name_space string
Log_file_name_convert string
Processor_group_name string
Service_names string test141

Sql> select Dbid,name from V$database;

DBID NAME
---------- ---------
4003894062 TEST141

2, check the monitoring
[Email protected] ~]$ lsnrctl status

Lsnrctl for Linux:version 11.2.0.3.0-production on April-September-2017 19:23:58

Copyright (c) 1991, Oracle. All rights reserved.

Connecting to (Description= (address= (protocol=tcp) (host=192.168.5.233) (port=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version Tnslsnr for Linux:version 11.2.0.3.0-production
Start Date January-September-2017 23:46:38
Uptime 2 days hr. Notoginseng min. sec
Trace level off
Security On:password or Local OS authentication
SNMP OFF
Listener Parameter File/u01/app/oracle/product/11.2.0/db/network/admin/listener.ora
Listener Log File/u01/app/oracle/product/11.2.0/db/network/log/listener.log
Listening Endpoints Summary ...
(Description= (address= (protocol=tcp) (host=192.168.5.233) (port=1521)))
(Description= (address= (PROTOCOL=IPC) (key=extproc1521)))
Services Summary ...
Service "test141" has 1 instance (s).
Instance "test141", status ready, have 1 handler (s) for the This service ...
The command completed successfully
--The above check can be omitted.

--Start Nid to modify name
Approximate steps: Close db, Mount DB, nid dbname, modify Init*.ora, modify environment variables and open DB, rebuild (s) pfile, modify corresponding names in Tnsname.ora and Listener.ora and start
You must know the SYS password before you close the DB, and if you don't know it, change it.
sql> alter user SYS identified by qwer1234;
User altered.

1. Close the database and boot to mount mode
Sql> shut Immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
Sql> STARTUP MOUNT
ORACLE instance started.

Total System Global area 2087780352 bytes
Fixed Size 2229944 bytes
Variable Size 687868232 bytes
Database buffers 1392508928 bytes
Redo buffers 5173248 bytes
Database mounted.

2, NI modified db_name
[email protected] admin]$ nid target=sys/qwer1234 dbname=test233

Dbnewid:release 11.2.0.3.0-production on Monday September 4 19:26:25 2017
Copyright (c) 1982, Oracle and/or its affiliates. All rights reserved.
Connected to Database TEST141 (dbid=4003894062)
Connected to server version 11.2.0

Control Files in database:
/u01/app/oracle/oradata/dbdata/control01.ctl
/u01/app/oracle/fast_recovery_area/dbdata/control02.ctl

Change database ID and the database name TEST141 to TEST233? (Y/[n]) = Y

Proceeding with Operation
Changing database ID from 4003894062 to 3120964513
Changing database name from TEST141 to TEST233
Control file/u01/app/oracle/oradata/dbdata/control01.ctl-modified
Control file/u01/app/oracle/fast_recovery_area/dbdata/control02.ctl-modified
Datafile/u01/app/oracle/oradata/dbdata/system01.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/sysaux01.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/undotbs01.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/users01.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/dat_member.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/idx_member.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/dat_account.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/idx_account.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/dat_sysdb.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/idx_sysdb.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/dat_risk.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/idx_risk.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/dat_tppaml.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/idx_tppaml.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/dat_test.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/dat_ms_orders.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/pftp01.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/dat_cashreserve_01.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/dat_orders.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/idx_orders.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/dat_sscard.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/idx_sscard.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/dat_gdxt.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/idx_gdxt.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/dat_dinpaypos.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/idx_dinpaypos.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/dat_ercon.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/idx_ercon.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/dat_bill01.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/idx_bill01.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/temp01.db-dbid changed, wrote new name
Datafile/u01/app/oracle/oradata/dbdata/temp_pfpt.db-dbid changed, wrote new name
Control File/u01/app/oracle/oradata/dbdata/control01.ctl-dbid changed, wrote new name
Control File/u01/app/oracle/fast_recovery_area/dbdata/control02.ctl-dbid changed, wrote new name
Instance shut down

Database name changed to TEST233.
Modify parameter file and generate a new password file before restarting.
Database ID for database TEST233 changed to 3120964513.
All previous backups and archived redo logs for this database is unusable.
Database is not aware of previous backups and archived logs on Recovery area.
Database has been shutdown, open database with RESETLOGS option.
succesfully changed database name and ID.
dbnewid-completed succesfully.

3. Modify the parameter file
CD $ORACLE _home/dbs/init***.ora

Vi/u01/app/oracle/product/11.2.0/db/dbs/inittest141.ora
#*.db_name= ' test141 ' commented.
*.db_name= ' test233 ' added to the name you want to change

VI. bash_profile

#export oracle_hostname=test141
Export oracle_hostname=test233
#export oracle_sid=test141
Export oracle_sid=test233

#export oracle_unqname=test141
Export oracle_unqname=test233

4. Re-enter the environment variable and start the database
[[email protected] ~]$ source. bash_profile
[Email protected] ~]$ Sqlplus/as SYSDBA

Sql*plus:release 11.2.0.3.0 Production on Monday September 4 19:33:40 2017

Copyright (c) 1982, Oracle. All rights reserved.

Connected to an idle instance.

sql> startup pfile = '/u01/app/oracle/product/11.2.0/db/dbs/inittest141.ora ';
ORACLE instance started.

Total System Global area 2087780352 bytes
Fixed Size 2229944 bytes
Variable Size 486541640 bytes
Database buffers 1593835520 bytes
Redo buffers 5173248 bytes
Database mounted.
ORA-01589: To open a database you must use the Resetlogs or Noresetlogs option

sql> ALTER DATABASE open resetlogs;

Database altered.

5. Regenerate the Pfile file
Sql> create SPFile from pfile= '/u01/app/oracle/product/11.2.0/db/dbs/inittest141.ora ';

File created.

elapsed:00:00:00.06
Sql> create Pfile from SPFile;

File created.

6. Modify the Monitoring configuration
CD $ORACLE _home/network/admin
VI Tnsname.ora

test233 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.5.233) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
# (service_name = test141)
(service_name = test233)
)
)

VI Listener.ora
With service_name words also modified to test233

Reload or start
[Email protected] admin]$ Lsnrctl Reload/start

Oracle NID modifies DBName

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.