Академический Документы
Профессиональный Документы
Культура Документы
de
Once again, dbca has failed me when I tried to create a second database - it did not detect my ASM instance(s). I had to
revert to the good old scripted approach to create the second database but that was a welcome challenge. Actually, it's
not that difficult at all: a RAC database is just a single instance database which happens to run on multiple severs over
shared storage. All you need is an extra redo log thread per additional instance and another undo tablespace (I know
that this is oversimplified).
The article assumes that you already have a clustered ASM installation up and running on Linux, so let's get going.
My database is called RACDB, instances are RACDB1 and RACDB2. My hostnames are node1 and node2, it's a
Standard Edition 2 node RAC install using ASM. My $ORACLE_BASE is /u01/app/oracle, $ORACLE_HOME therefore
translates to /u01/app/oracle/product/10.2.0/db_1, I also have an $ASM_HOME in
$ORACLE_BASE/product/10.2.0/asm_1 in addition to the Clusterware install.
To allow for trace and dump file generation, go to $ORACLE_BASE and create the top level directory RACDB. Descend
into RACDB and create {a,b,c,u}dump, scripts, dpump and pfile directories. Repeat this for the second host as well.
Initial init.ora
*.audit_file_dest='/u01/app/oracle/admin/RACDB/adump'
*.background_dump_dest='/u01/app/oracle/admin/RACDB/bdump'
*.cluster_database=false
*.compatible='10.2.0.1.0'
*.core_dump_dest='/u01/app/oracle/admin/RACDB/cdump'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='RACDB'
*.db_recovery_file_dest='+DATA'
*.db_recovery_file_dest_size=2G
*.sga_target = 250M
*.job_queue_processes=10
*.log_checkpoints_to_alert=TRUE
*.pga_aggregate_target=100M
*.processes=500
*.remote_listener='LISTENERS_RACDB'
*.remote_login_passwordfile='exclusive'
*.sessions=200
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/RACDB/udump'
RACDB1.instance_name = RACDB1
Note the instance_name and db_name parameters. There is no reference to any RAC stuff here at all. Note also the
absence of "control_files". If you set it to a value, the create database statement will fail (Rember that ASM = OMF at
large!)
You also need to create a password file using orapw: orapw file=orapwRACDB1 password=sysRACDB.
Network configuration
http://www.the-playground.de/joomla/ Powered by Joomla! Generated: 10 March, 2011, 20:43
the playground.de
Now go to $ORACLE_HOME/network/admin and edit tnsnames.ora to add entries for your instances, the database and
the listeners. The listeners_racdb entry has to look like this:
LISTENERS_RACDB =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))
)
I usually have an entry for the database on my server but don't bother with individual instances. Example:
RACDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RACDB)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)
My application developers unfortunately don't make use of FCF/TAF or any more advance failover technology so this is
ok for my case.
Perform the finishing touches (add database instance to /etc/oratab and such), export the ORACLE_SID to RACDB1 and
start the instance:
Correct any errors until you don't have any more problems brining the instance to nomount state. Then run the create
database script, an example is given below:
Note that I am using WE8ISO8859P1 character set - you might need something different. Any use of the "reuse" keyword
will cause the statement to fail.
Once that command has finished, enter "show parameter control" to get the location of the control file and add this to
your init.ora file. If you don't, the database will not mount after the next bounce!
The rest of the database creation is fairly standard - run at least catalog.sql, catproc.sql and catclust.sql. If you need
Java or XMLDB consult the Oracle documentation on which scripts to run in addition.
You should create a user tablespace and make it the database default tablespace to avoid objects "accidentally" stored
in SYSTEM or SYSAUX.
Tablespace created
Database altered
A few more steps are now necessary to convert your single instance to a RAC database. Edit initRACDB1.ora and add
the cluster parameters:
*.cluster_database_instances=2
*.cluster_database=true
RACDB1.instance_number=1
RACDB2.instance_number=2
RACDB2.thread=2
RACDB1.thread=1
*.undo_management='AUTO'
RACDB1.undo_tablespace='UNDOTBS1'
RACDB2.undo_tablespace='UNDOTBS2'
RACDB1.instance_name = RACDB1
RACDB1.instance_name = RACDB2
This concludes the init.ora moification. In our case we have both information about the local and remote node in it, which
makes it easy to copy the file across to node2 (and rename it to initRACDB2.ora). Now create the second undo
tablespace:
Tablespace created
Database altered
Issue a "shutdown immediate" now, then start the instance. It should come up ok, you'll find additional information in the
alert.log about RAC specifics. The important bit is the message stating that the database is mounted in shared mode
(CLUSTER_DATABASE=TRUE).
Make sure you copy tnsnames.ora, initRACDB1.ora (as initRACDB2.ora), the password file over to the second node.
Add RACDB2 to /etc/oratab as well. Then rename all *RACDB1* files to *RACDB2* if you haven't done so already.
Finally start your second instance - and voila! You have a proper RAC database up and running now. Check
v$active_instances to make sure both appear in that view.
Finishing touches
I don't recmmend running RAC with pfiles, that never has been a good idea. Rather, I'd create the spfile in ASM:
Shut down both instances next and register the database and its instances with Clusterware as oracle:
DONE!