Mark Rittman's Oracle Weblog
This is the weblog for Mark Rittman, a developer working on Oracle Data Warehousing technology based in Brighton, England. You can contact me at mark@rittman.net.
        

20 July 2003

Ben Kitchens asks:

"I am just starting out as a DBA. I have a question about Oracle 8i. I'm not sure how exactly to have two or more Databases on the instance and then move between them? If you could help that would be wonderful."

Sure. You can only have one database active on one instance, although you can select which database gets attached to an instance when you start the instance up.

For example, you create a database from scratch, either through the CREATE DATABASE command, or using the DBCA utility. You then set the ORACLE_HOME and ORACLE_SID environment variables to this database, and issue the 'startup' command from either SQL*Plus (oracle 9i upwards) or svrmgrl (oracle 8i and below). This will then start the instance using the database specified in the two environment variables.

If at a later date, you want to deattach that database from the instance and start another one, issue a 'shutdown immediate' from sql*plus / svrmrgl, change the environment variables to point to the new database, then issue a 'startup' to bring the new database up.

Alternatively, if you want both databases to be active at the same time, start each one under it's own instance.

The key thing here to remember is the different between an instance and a database. A database is a set of files (data, redo, ctl and so on) whilst an instance is a set of processes (SMON, PMON, DBWR, etc) and a shared memory segment (SGA). An instance may mount and open any database -- however it may only open a single database at any time.

Therefore, in summary, if you want to have an instance switch between different databases, then shutdown the instance, change the ORACLE_HOME and ORACLE_SID environment variables to point to the new database, then startup the instance again.


4:43:57 PM    

© Copyright 2003 Mark Rittman.
 
July 2003
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Jun   Aug






Click here to visit the Radio UserLand website.

Subscribe to "Mark Rittman's Oracle Weblog" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.