Well, before we dive into the gory details, lets first create an init.ora file and start the instance in nomount state. Here’s how we do it:
1) Create init
Now, we will start our instance in NOMOUNT state.
SQL> startup nomount pfile=C:\oracle\ora10g\admin\TEST\pfile\initTEST.ora ORACLE instance started. Total System Global Area 570425344 bytes Fixed Size 1250188 bytes Variable Size 293604468 bytes Database Buffers 268435456 bytes Redo Buffers 7135232 bytes This will start the following processes PMON, MMAN, DBW0, LGWR, CKPT, and SMON. 3) Create database:
Finally, issue the Create database command:
SQL> @Create_Database_TEST.sql
Database Created.
########################################### #Create_Database_TEST.sql
###########################################
CREATE DATABASE TEST USER SYS IDENTIFIED BY mgrTEST USER SYSTEM IDENTIFIED BY mgrTEST LOGFILE GROUP 1 ('C:\oracle\ora10g\admin\TEST\data\redo01.log') SIZE 128M, GROUP 2 ('C:\oracle\ora10g\admin\TEST\data\redo02.log') SIZE 128M, GROUP 3 ('C:\oracle\ora10g\admin\TEST\data\redo03.log') SIZE 128M MAXLOGFILES 10 MAXLOGMEMBERS 5 MAXLOGHISTORY 1 MAXDATAFILES 60 MAXINSTANCES 1 CHARACTER SET AR8ISO8859P6 DATAFILE 'C:\oracle\ora10g\admin\TEST\data\system01.dbf' SIZE 257M autoextend on EXTENT MANAGEMENT LOCAL SYSAUX DATAFILE 'C:\oracle\ora10g\admin\TEST\data\sysaux01.dbf' SIZE 257M autoextend on DEFAULT TEMPORARY TABLESPACE TBS_1 TEMPFILE 'C:\oracle\ora10g\admin\TEST\data\temp01.dbf' SIZE 257M UNDO TABLESPACE undotbs1 DATAFILE 'C:\oracle\ora10g\admin\TEST\data\undotbs01.dbf' Size 257M AUTOEXTEND ON MAXSIZE UNLIMITED; ###########################################
Let’s see what Oracle actually does when you issue the Create Database command.
- Database is Mounted in Exclusive Mode.
- Mounts Redo Thread 1 and opens the log at sequence 1.
- Cache recovery process is enabled by SMON.
- Oracle then creates the SYSTEM tablespace
- Creates a rollback segment named SYSTEM in SYSTEM tablespace. As there is no UNDO tablespace yet created in the database, this tablespace is used by Oracle during the rest of the creation process. It’s size is also very small Initial = 50K and Next = 50K. Once the database is created you can issue the following query SQL> select owner, segment_type, tablespace_name, bytes, blocks, extents, initial_extent, next_extent 2 from dba_segments 3 where segment_name = 'SYSTEM'; OWNER SEGMENT_TYPE TABLESPACE_NAME BYTES BLOCKS EXTENTS INITIAL_EXTENT NEXT_EXTENT ----- ------------ --------------- ---------- ---------- ---------- -------------- ----------- SYS ROLLBACK SYSTEM 393216 48 6 114688 1048576
- Oracle now creates the UNDO tablespace and makes it online.
- Creates SYSAUX tablespace.
- Creates temporary tablespace
- Alters the temporary tablespace of the database to the newly created temporary tablespace.
- Alters the database to SYSTEM tablespace.
- SMON process enables the transaction recovery.
- QMNC process is started.
- Database is opened.
nice 1 :)
ReplyDelete