Atikh's DBA blog
  • Home
  • Oracle
  • MySQL
  • MongoDB
  • PostgreSQL
  • Snowflake
  • About Me
  • Contact Us

using nid to change oracle database SID or oracle database name

 Atikh Shaikh     oracle     No comments   

In this article, we will discuss using the nid utility to change database sid or database name without dropping and recreating the database, before starting this activity make sure you have a good backup of the database as a rollback strategy.

 current database name:        technodb

new database name:              oracledb

 we need to perform one step after another. 

Step 1: Create pfile from spfile or take backup of pfile or password file

SQL> show parameter pfile

 NAME                  VALUE

-------------------- --------------------------------------

spfile                C:\APP\ORACLE\PRODUCT\11.2.0.4\DBHOME_1\ DATABASE\SPFILETECHNODB.ORA

 

SQL> create pfile from spfile;

File created.

SQL>

Step 2: shutdown the database and again open the database using the startup mount option


SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

 

SQL> startup mount

ORACLE instance started. 

Total System Global Area 3156725760 bytes

Fixed Size                  2179896 bytes

Variable Size            1728056520 bytes

Database Buffers         1409286144 bytes

Redo Buffers               17203200 bytes

Database mounted.

 

Step 3: run nid utility with syntax

nid target=sys/<password>@technodb dbname=oracledb 

C:\app\oracle>nid target=sys/<password>@technodb dbname=oracledb

 

DBNEWID: Release 11.2.0.1.0 - Production on Sat Jul 2 23:10:18 2022

 

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Connected to database TECHNODB (DBID=2727431841)

Connected to server version 11.2.0

Control Files in database:

    C:\APP\ORACLE\ORADATA\TECHNODB\CONTROL01.CTL

    C:\APP\ORACLE\FLASH_RECOVERY_AREA\TECHNODB\CONTROL02.CTL

Change database ID and database name TECHNODB to ORACLEDB? (Y/[N]) => Y

Proceeding with operation

Changing database ID from 2727431841 to 3726858970

Changing database name from TECHNODB to ORACLEDB

    Control File C:\APP\ORACLE\ORADATA\TECHNODB\CONTROL01.CTL - modified

    Control File C:\APP\ORACLE\FLASH_RECOVERY_AREA\TECHNODB\CONTROL02.CTL - modified

    Datafile C:\APP\ORACLE\ORADATA\TECHNODB\SYSTEM01.DB - dbid changed, wrote new name

    Datafile C:\APP\ORACLE\ORADATA\TECHNODB\SYSAUX01.DB - dbid changed, wrote new name

    Datafile C:\APP\ORACLE\ORADATA\TECHNODB\UNDOTBS01.DB - dbid changed, wrote new name

    Datafile C:\APP\ORACLE\ORADATA\TECHNODB\USERS01.DB - dbid changed, wrote new name

    Datafile C:\APP\ORACLE\ORADATA\TECHNODB\EXAMPLE01.DB - dbid changed, wrote new name

    Datafile C:\APP\ORACLE\ORADATA\TECHNODB\TEMP01.DB - dbid changed, wrote new name

    Control File C:\APP\ORACLE\ORADATA\TECHNODB\CONTROL01.CTL - dbid changed, wrote new name

    Control File C:\APP\ORACLE\FLASH_RECOVERY_AREA\TECHNODB\CONTROL02.CTL - dbid changed, wrote new name

    Instance shut down

 

Database name changed to ORACLEDB.

Modify parameter file and generate a new password file before restarting.

Database ID for database ORACLEDB changed to 3726858970.

All previous backups and archived redo logs for this database are unusable.

Database is not aware of previous backups and archived logs in Recovery Area.

Database has been shutdown, open database with RESETLOGS option.

Successfully changed database name and ID.

DBNEWID - Completed successfully.

C:\app\oracle>

Step 4: As in above, we can see the database name is changed, and the database is shutdown now we need to change it in spfile as well. Open database in nomount mode and change database name using alter system command

 

C:\app\oracle >sqlplus 

SQL*Plus: Release 11.2.0.1.0 Production on Sat Jul 2 23:12:19 2022 

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

Enter user-name: /as sysdba

Connected to an idle instance. 

SQL> startup nomount

ORACLE instance started. 

Total System Global Area 3156725760 bytes

Fixed Size                  2179896 bytes

Variable Size            1728056520 bytes

Database Buffers         1409286144 bytes

Redo Buffers               17203200 bytes

SQL>

 

SQL> alter system set db_name=oracledb scope=spfile;

System altered.

SQL>

 

Step 5: if you are using database on Linux/Unix- change the entry in oratab and if you are using the database on windows, then create a new sid using oradim utility, I have my database on windows, so I have created a new sid in windows services using oradim and delete old sid

 C:\windows\system32>oradim -new -sid oracledb

Instance created.

 

C:\windows\system32>oradim -delete -sid technodb

Instance deleted.

 

C:\windows\system32>

 

Step 6: Now change spfile name to with oracle database name  from spfiletechnodb.ora to spfileoracledb.ora and open the database step-wise as we need to open the database using resetlogs options

SQL> startup nomount

ORACLE instance started. 

Total System Global Area 3156725760 bytes

Fixed Size                  2179896 bytes

Variable Size            1728056520 bytes

Database Buffers         1409286144 bytes

Redo Buffers               17203200 bytes

SQL>

SQL> alter database mount;

Database altered.

SQL> show parameter db_name

NAME                                 TYPE        VALUE

----------------- ----------- ------------------------------

db_name                              string      ORACLEDB

SQL>

SQL> alter database open resetlogs;

 

Step 7: Change entry in the listener.ora and tnsnames.ora and just reload the listener using command

lsnrctl reload LISTENER 

In this way, you can database name has been changed, remember, only the database name can be changed


  • Share This:  
  •  Facebook
  •  Twitter
  •  Instagram
  •  Pin
  •  linkedin
  •  reddit
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Author

Atikh Shaikh
View my complete profile

Categories

  • MongoDB (18)
  • Oracle 12c (30)
  • Oracle12cR2 New Feature (3)
  • PostgreSQL (20)
  • RMAN (10)
  • Snowflake (8)
  • mysql (23)
  • oracle (74)

Blog Archive

  • ►  2018 (38)
    • ►  November (25)
    • ►  December (13)
  • ►  2019 (33)
    • ►  January (15)
    • ►  February (6)
    • ►  March (2)
    • ►  April (5)
    • ►  May (5)
  • ►  2020 (5)
    • ►  April (1)
    • ►  May (2)
    • ►  July (2)
  • ►  2021 (8)
    • ►  June (3)
    • ►  July (3)
    • ►  August (1)
    • ►  December (1)
  • ▼  2022 (33)
    • ►  May (3)
    • ►  June (10)
    • ▼  July (3)
      • using nid to change oracle database SID or oracle ...
      • pfile and spfile in oracle database
      • Flashback query in oracle
    • ►  August (4)
    • ►  September (8)
    • ►  October (3)
    • ►  November (2)
  • ►  2023 (14)
    • ►  February (1)
    • ►  April (5)
    • ►  May (2)
    • ►  June (1)
    • ►  September (1)
    • ►  October (1)
    • ►  December (3)
  • ►  2024 (5)
    • ►  January (2)
    • ►  March (3)
  • ►  2025 (6)
    • ►  March (1)
    • ►  April (3)
    • ►  May (2)

Popular Posts

  • ORA-29283: invalid file operation: unexpected "LFI" error (1509)[29437]
    I was trying to export the schema in my windows PC, it got stuck with below error    C:\Users\shaik\Videos\technodba exp>expdp userid...
  • PostgreSQL : How to get data directory location for PostgreSQL instance
    Sometimes, you start working on a PostgreSQL instance but forget about the data directory, here we will discuss different methods to know th...
  • Oracle 23ai : Use of NOVALIDATE Constraints in IMPDP
    While performing impdp operations in the Oracle database, Oracle performs validation checks for every constraint on the imported table, that...
  • ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
    In previous articles, we have learned about user creation and grants  in MySQL in detail, but there are a few privileges called global priv...
  • Oracle Dataguard Broker Configuration (DGMGRL)
    Data Guard Broker is a command-line interface that makes managing primary and standby databases easy. DBA can use a single command to switch...

Labels

oracle Oracle 12c mysql PostgreSQL MongoDB oracle 19c Oracle23c oracle19c Orale PDB-CDB oracle12c python AWS Oracle ASM Virtualbox pluggable database storage engine

Pages

  • Disclaimer
  • Privacy Policy

Follow TechnoDBA

Copyright © Atikh's DBA blog | Powered by Blogger