vicker313 tech blog

April 27, 2009

Change Oracle 10g DB name in Linux

Filed under: Linux, Oracle — Tags: — vicker313 @ 8:59 am
  1. First of all backup the database.
  2. Then login as SYSDBA to check out the DB ID and DB Name by using the following statement, using SQLPLUS or your favourite SQL Client.
  3. select dbid, name from v$database

  4. Shutdown the database and startup it in mount state (SQLPLUS).
  5. shutdown immediate
    startup mount

  6. Use the DBNEWID command to change the DB ID, you need to login as user with privilege SYSDBA (Terminal).
  7. nid target=username/password@servicename dbname=newdbname

  8. Shutdown database again (SQLPLUS).
  9. shutdown immediate

  10. Change db_name initialization parameter in the initialization file, normally inside database folder/admin/pfile (Terminal).
  11. Create a new password file using ORAPWD utility, the file usually in Oracle folder/dbs (Terminal).
  12. orapwd file=orapwSID password=password entries=

  13. Start database in mount state (SQLPLUS).
  14. startup mount

  15. Open database with RESETLOGS option (SQLPLUS).
  16. alter database open resetlogs

  17. Verify the database id and name using following statement (SQLPLUS).
  18. select dbid, name from v$database

  19. Don’t forget to change ORACLE_SID parameter in .bash_profile and database name in /etc/oratab
    (Terminal).
Advertisement

1 Comment »

  1. [...] Rename the new database to mydb2 [...]

    Pingback by Copy or Move Oracle Database « vicker313 tech blog — June 11, 2011 @ 12:18 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.