Tuesday, July 04, 2006
Creating & restoring Oracle Database Manually
Steps to create a Database manually under Windows:
1. Setting SID environment variable: | C:\ > | SET ORACLE_SID=SKDB |
2. To create a new Oracle instance: | C:\ > | ORADIM -NEW -SID SKDB -INTPWD password -STARTMODE a |
3. To startup a service & instance: | C:\ > | ORADIM -STARTUP -SID SKDB |
4. Starting SQL & connecting: | C:\ > | SQLPLUS /NOLOG |
5. Starting up Oracle Server in no mount mode: | SQL> | STARTUP NOMOUNT pfile='D:\Oracle\admin\SKDB\pfile\init.ora' |
6. Creating database: | SQL> | CREATE DATABASE SKDB |
7. CREATING default temporary | SQL> | CREATE TEMPORARY TABLESPACE temp TEMPFILE |
8. Creating views on base_tables, | SQL> | CONNECT SYS AS SYSDBA; |
9. Creating packages & procedures | SQL> | @D:\Oracle\ora90\rdbms\admin\CATPROC.SQL; |
10. Creating Product User Profile | SQL> | CONNECT SYSTEM/MANAGER; @D:\Oracle\ora90\sqlplus\admin\PUPBLD.SQL; |
BACKING UP / CLONING an existing Database :
Purpose :
rename a database as ORACLE does not allow two database to have the same name on the same host.
to change database settings such as maxlogfiles
lost control file? Need to recreate it....
Steps to backup control file, redo log files & data_files :
SQL > | ALTER DATABASE BACKUP CONTROLFILE TO TRACE; Response: Database altered Result : control file creation script backed up at USER_DUMP_DEST\ORAxxxxx.TRC ************************************************ *** SESSION ID:(7.3) 2006-07-05 11:06:28.000 # The following commands will create a new control file and use it # Data used by the recovery manager will be lost. Additional logs may STARTUP NOMOUNT DATAFILE # Recovery is required if any of the datafiles are restored backups, # Database can now be opened normally. # Commands to add tempfiles to temporary tablespaces. # End of tempfile additions. ************************************************ |
SQL > | SHUTDOWN NORMAL; [or IMMEDIATE] note: don't use shutdown abort |
DOS> | Copy all datafiles & redo log files to an alternate filesystem location |
Restoring a backed up Database: (Recreating control file):
Edit init.ora with the correct path names for control files, log_archive_dest,
dump destinations and supply the instance_name & db_name.
Edit dumped control file with the correct path names for the redo log & datafiles.
C:\ > | SET ORACLE_SID=chik |
C:\ > | ORADIM -STARTUP -SID chik [-pfile 'D:\Oracle\admin\chik\pfile\init.ora'] |
C:\ > | SQLPLUS /NOLOG |
SQL > | CONNECT / AS SYSDBA |
SQL > | STARTUP NOMOUNT pfile='D:\Oracle\admin\chik\pfile\init.ora' |
SQL > | Rem Using dumped control file to restore the database. MAXLOGFILES 5 LOGFILE GROUP 1 'D:\Oracle\oradata\chik\REDO01.LOG' SIZE 100M, Rem STANDBY LOGFILE 'D:\Oracle\oradata\chik\SYSTEM01.DBF', CHARACTER SET WE8MSWIN1252; |
| Rem Recovery is required if any of the datafiles are restored backups, |
SQL > | Rem Database can now be opened normally. |
| Rem Commands to add tempfiles to temporary tablespaces. |
| Done! |
|