1. Create a directory
Mkdir d: oracleproduct10.1.0database
Mkdir e: oracleadminOra10gdump
Mkdir e: oracleadminOra10gcdump
Mkdir e: oracleadminOra10gcreate
Mkdir e: oracleadminOra10gpfile
Mkdir e: oracleadminOra10gudump
Mkdir e: oracleflash_recovery_area
Mkdir e: oracleoradata
Mkdir e: oracleoradataOra10g
2. Generate a windows Service, create a password file, and run the command in cmd.
Set ORACLE_SID = dbca -- set the oracle Instance name to ora10g in the green section.
D: oracleproduct10.1.0DB_1inoradim.exe-new-sid ORA10G-startmode manual-spfile d: oracleproduct10.1.0DB_1inoradim.exe-edit-sid ORA10G-startmode a-spfile
-- Create an instance named dbca and change the Manual start mode to automatic start.
D: oracleproduct10.1.0DB_1inorapwd.exe file = d: oracleproduct10.1.0db _ 1PWDOra10g. ora password = sysPassword force = y
-- Use oracle's built-in orapwd to create a sysPassword password for sys users
3. Execute the database creation script
D: oracleora92insqlplus/nolog @ D: oracleadmindbcascriptsCreateDB. SQL
D: oracleora92insqlplus/nolog @ D: oracleadmindbcascriptsCreateDBFiles. SQL
D: oracleora92insqlplus/nolog @ D: oracleadmindbcascriptsCreateDBCatalog. SQL
D: oracleora92insqlplus/nolog @ D: oracleadmindbcascriptspostDBCreation. SQL
-- The simhei part is the script to be called to create the database.
CreateDB. SQL
Connect SYS/change_on_install as SYSDBA -- this is the password we just set to connect to the database as sysdba
Connect SYS/change_on_install as SYSDBA -- this is the password we just set to connect to the database as sysdba
Set echo on
Spool D: oracleora92assistantsdbcalogsCreateDB. log write log
Startup nomount pfile = "D: oracleadmindbcascriptsinit. ora"; call the parameter file to start the database to load the instance only.
Create database dbca
MAXINSTANCES 1
MAXLOGHISTORY 1
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXDATAFILES 100 -- controls the maximum number of logs related to file records, log groups, and maximum number of data files.
DATAFILE 'd: oracleoradatadbcasystem01.dbf 'size 250 m reuse autoextend on next 10240 K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
Default temporary tablespace temp tempfile 'd: oracleoradatadbca emp01.dbf 'size 40 m reuse autoextend on next 640 K MAXSIZE UNLIMITED
Undo tablespace "UNDOTBS1" DATAFILE 'd: oracleoradatadbcaundotbs01.dbf' SIZE 200 m reuse autoextend on next 5120 k maxsize unlimited -- create a system, temporarily, roll back the tablespace itpub personal space! DJ5l {! I4W r f
Character set ZHS16GBK
National character set AL16UTF16 -- CHARACTER SET
Logfile group 1 ('d: oracleoradatadbca edo01.log ') SIZE 102400 K,
GROUP 2 ('d: oracleoradatadbca edo02.log) SIZE 102400 K,
GROUP 3 ('d: oracleoradatadbca edo03.log ') SIZE 102400 K; -- create a log file rent and a member
Spool off
Exit;
2. CreateDBFiles. SQL
Connect SYS/change_on_install as SYSDBA
Set echo on
Spool D: oracleora92assistantsdbcalogsCreateDBFiles. log
Create tablespace "INDX" logging datafile 'd: oracleoradatadbcaindx01.dbf 'size 25 m reuse autoextend on next 1280 k maxsize unlimited extent management local segment space management auto;
Create tablespace "TOOLS" logging datafile 'd: oracleoradatadbca ools01.dbf 'size 10 m reuse autoextend on next 320 k maxsize unlimited extent management local segment space management auto;
Create tablespace "USERS" logging datafile 'd: oracleoradatadbcausers01.dbf 'size 25 m reuse autoextend on next 1280 k maxsize unlimited extent management local segment space management auto; -- CREATE the TABLESPACE to be used by relevant USERS
Spool off
Exit;
Third: CreateDBCatalog. SQL
-- Create a system data dictionary and store it in the system tablespace, related tables, views, etc.
Connect SYS/change_on_install as SYSDBA
Set echo on
Spool D: oracleora92assistantsdbcalogsCreateDBCatalog. log
@ D: oracleora92 dbmsadmincatalog. SQL;
@ D: oracleora92 dbmsadmincatexp7. SQL;
@ D: oracleora92 dbmsadmincatblock. SQL;
@ D: oracleora92 dbmsadmincatproc. SQL;
@ D: oracleora92 dbmsadmincatoctk. SQL;
@ D: oracleora92 dbmsadminowminst. plb;
Connect SYSTEM/manager
@ D: oracleora92sqlplusadminpupbld. SQL;
Connect SYSTEM/manager
Set echo on
Spool D: oracleora92assistantsdbcalogssqlPlusHelp. log
@ D: oracleora92sqlplusadminhelphlpbld. SQL helpus. SQL;
Spool off
Spool off
Exit;
Fourth: postDBCreation. SQL
Connect SYS/change_on_install as SYSDBA
Set echo on
Spool D: oracleora92assistantsdbcalogspostDBCreation. log
@ D: oracleora92 dbmsadminutlrp. SQL; -- compile related views and package objects.
Shutdown; -- shut down the database
Connect SYS/change_on_install as SYSDBA
Set echo on
Spool D: oracleora92assistantsdbcalogspostDBCreation. log
Create spfile = 'd: oracleora92databasespfiledbca. ora 'FROM pfile = 'd: oracleadmindbcascriptsinit. ora ';
-- Create a server parameter file to replace the file initialization parameter file, so that the parameter can take effect without restarting the database.
You can see the storage location of the spfile file from the above.
Startup; -- start the database and create the database.
Exit;
From the above, we can see that there are 10 steps to create a database:
Step 1: Create a trace directory folder
Step 2: Create an instance and start the password
Step 3: Create the initialization parameter file init. ora
Step 4: connect to the instance
Step 5: Start the instance to the nomount status
Step 6: Create a database
Step 7: Create a tablespace
Step 8: run the script to create a data dictionary
Step 9: Create a server parameter file (this Step is not required, but oracle recommends this Step). The benefits will be listed in the summary below.
The script in linux is also posted below, which is almost the same as that in windows.
#! /Bin/sh
Mkdir/oradata/ora9i
Mkdir/oradata/ora9i/controlfile
Mkdir/oradata/ora9i/redofile
Mkdir/orasys/oracle/admin
Mkdir/orasys/oracle/admin/ora9i
Mkdir/orasys/oracle/admin/ora9i/bdump
Mkdir/orasys/oracle/admin/ora9i/cdump
Mkdir/orasys/oracle/admin/ora9i/create
Mkdir/orasys/oracle/admin/ora9i/udump
Mkdir/orasys/oracle/admin/ora9i/pfile
Cp init. ora/orasys/oracle/product/9.2.0/dbs /.
Export ORACLE_BASE =/orasys/oracle
Export ORACLE_HOME = $ ORACLE_BASE/product/9.2.0
Export ORACLE_SID = ora9i
Export ORA_NLS33 = $ ORACLE_HOME/ocommon/nls/admin/data
LD_LIBRARY_PATH = $ ORACLE_HOME/lib:/usr/lib
LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/usr/local/lib
Export LD_LIBRARY_PATH
Export PATH = $ PATH: $ ORACLE_HOME/bin
Echo Add this entry in the oratab: ora9i:/orasys/oracle/product/9.2.0: Y
/Orasys/oracle/product/9.2.0/bin/orapwd file =/orasys/oracle/product/9.2.0/dbs/orapwora9i password = change_on_install
/Orasys/oracle/product/9.2.0/bin/sqlplus/nolog @/home/oracle/create_script/CreateDB. SQL
/Orasys/oracle/product/9.2.0/bin/sqlplus/nolog @/home/oracle/create_script/CreateDBFiles. SQL
/Orasys/oracle/product/9.2.0/bin/sqlplus/nolog @/home/oracle/create_script/CreateDBCatalog. SQL
/Orasys/oracle/product/9.2.0/bin/sqlplus/nolog @/home/oracle/create_script/postDBCreation. SQL