Steps for creating a manual oracle10g Database

Source: Internet
Author: User

Platform: RHEL4.5, Oracle10.2.0.1
Plan: db_name = ORCLDB, db_unique_name/ORACLE_SID = WENDING
The above two parameters can also be set to the same, here is the main difference.

1. Set Environment Variables
$ Export ORACLE_BASE =/u01/app/oracle
$ Export ORACLE_HOME = $ ORACLE_BASE/product/10.2.0/db_1

$ Export ORACLE_SID = WENDING



2. Create an initialization parameter file
$ Vi $ ORACLE_HOME/dbs/init $ ORACLE_SID.ora
# The following are required parameters for creating a database:
Control_files = (/orahome/oradata/control1.ctl,/orahome/oradata/control2.ctl,/orahome/oradata/control3.ctl)
Undo_management = AUTO
Undo_tablespace = UNDOTBS1
Db_name = ORCLDB
Db_unique_name = WENDING
DB _ block_size = 8192
Sga_max_size = 320 M

Sga_target = 320 M


# The following are the parameters that need to be set for the general database creation. If this parameter is not set, the default value is used.
Audit_file_dest =/u01/app/oracle/admin/WENDING/adump # default $ ORACLE_HOME/rdbms/adump is not set
Background_dump_dest =/u01/app/oracle/admin/WENDING/bdump # default $ ORACLE_HOME/rdbms/log is not set
Core_dump_dest =/u01/app/oracle/admin/WENDING/cdump # default $ ORACLE_HOME/rdbms/dbs is not set
User_dump_dest =/u01/app/oracle/admin/WENDING/udump # default $ ORACLE_HOME/rdbms/log is not set
Db_domain = LK # null by default when not set
Open_cursors = 1500 # do not set the default value of 50
Processes = 500 # default 40 is not set
Log_archive_dest_1 = 'location =/orahome/arch/wending' # If this parameter is not set, the default value is null. the archive is stored in $ ORACLE_HOME/rdbms/dbs/arch.
Log_archive_format = 'Log _ % t _ % s _ % r. arc' # The default value % t _ % s _ % r. dbf is not set.
Job_queue_processes = 10 # do not set the default value to 0

Undo_retention = 10800 # default 900 is not set


# To enable the audit function, set the following parameters:
Audit_sys_operations = TRUE
Audit_trail = db, extended # Note: if it is converted to a physical standby database in the future, the database cannot be set here; otherwise, the read only mode cannot be enabled for the physical standby database in the future.
Db_recovery_file_dest =/orahome/flash_recovery_area # required in OMF Mode

Db_recovery_file_dest_size = 2G # required for OMF Mode



# If you use OMF to manage database files, you need to set the following parameters:
Db_create_file_dest =/orahome/oradata # automatically create the./{db_name}/datafile directory under this directory.
Db_create_online_log_dest_1 =/orahome/oradata # automatically create the./{db_name}/onlinelog directory under this directory.



3. Create a password file
$ ORACLE_HOME/bin/orapwd file = $ ORACLE_HOME/dbs/orapw $ ORACLE_SID password = iamwangnc force = y

4. Create a directory
$ Rm-rf $ ORACLE_BASE/admin/$ ORACLE_SID
$ Mkdir-p $ ORACLE_BASE/admin/$ ORACLE_SID/adump
Mkdir-p $ ORACLE_BASE/admin/$ ORACLE_SID/bdump
Mkdir-p $ ORACLE_BASE/admin/$ ORACLE_SID/cdump
Mkdir-p $ ORACLE_BASE/admin/$ ORACLE_SID/dpdump
Mkdir-p $ ORACLE_BASE/admin/$ ORACLE_SID/udump
Mkdir-p $ ORACLE_BASE/admin/$ ORACLE_SID/pfile



# If you use OMF to manage database files, you do not need to create the following directory
$ Rm-rf/orahome/oradata/WENDING
Mkdir-p/orahome/oradata/WENDING
$ Rm-rf/orahome/arch/WENDING
Mkdir-p/orahome/arch/WENDING



5. Start the instance and create the database after creating the spfile.
$ Sqlplus '/as sysdba'
SQL> create spfile from pfile; (pfile: $ ORACLE_HOME/dbs/init $ ORACLE_SID.ora is automatically read)
SQL> startup nomount
SQL> create database ORCLDB CONTROLFILE REUSE
MAXINSTANCES 8 MAXDATAFILES 100
MAXLOGHISTORY 1 MAXLOGFILES 16 MAXLOGMEMBERS 5
Character set ZHS16GBK national character set AL16UTF16
Logfile group 1 ('/orahome/oradata/WENDING/redo1.log') size 50 M reuse,
Group 2 ('/orahome/oradata/WENDING/redo2.log') size 50 M reuse,
Group 3 ('/orahome/oradata/WENDING/redo3.log') size 50 M reuse
Datafile '/orahome/oradata/WENDING/system. dbf' size 500 M reuse autoextend on next 10 M maxsize unlimited extent management local
Sysaux datafile '/orahome/oradata/WENDING/sysaux. dbf' size 100 M autoextend on next 10 M maxsize unlimited
Default temporary tablespace temp tempfile '/orahome/oradata/WENDING/temp01.dbf' size 100 M reuse autoextend on next 10 M maxsize unlimited
Undo tablespace undotbs1 datafile '/orahome/oradata/WENDING/undotbs1.dbf' size 100 M reuse autoextend on next 10 M maxsize unlimited
User sys identified by "iamwangnc" user system identified by "iamwangnc ";



You can also consider the following parameters for creating a database:
Set timezone = 'time _ zone_region'
Set timezone = '{+ |-} hh: mm'
FORCE LOGGING
After the database is created, the database is automatically open.
Note: MAXLOGFILES indicates the number of logfile groups that can be created, and MAXLOGMEMBERS indicates the number of members in each group. If the control file exceeded before 10.2, it is unnecessary in 10.2. Oracle automatically updates the two parameter values in the control file and does not need to recreate the control file! In oracle10g, the default value of MAXLOGFILES is 16, MAXLOGMEMBERS is 3, but cannot exceed 5 when new, or a ORA-02249 error occurs.
In addition, if you want to obtain the specified MAXxxx parameters in the future, you can use the dump control file to obtain: alter database backup controlfile to trace;

If you use OMF to manage database files, create a database using the following methods:
SQL> create database ORCLDB
Controlfile reuse ARCHIVELOG
Character set ZHS16GBK national character set AL16UTF16
Undo tablespace undotbs1
Default temporary tablespace temp;
Or you can create a character set in the minimum mode (the character set is automatically specified according to the operating system, and the default value is used for other parameters ):
SQL> create database ORCLDB;



7. Run the data dictionary script, where catalog and catproc are required. Other options are as follows:
SQL> spool/orahome/cat. log
SQL> @? /Rdbms/admin/catalog. SQL (create data dictionary view)
SQL> @? /Rdbms/admin/catproc. SQL (create a stored procedure package)
SQL> @? /Rdbms/admin/catblock. SQL (several lock-related views)
SQL> @? /Rdbms/admin/catoctk. SQL (password creation toolkit dbms_crypto_toolkit)
SQL> @? /Rdbms/admin/owminst. plb (create a workspace management object, such as dmbs_wm)
SQL> spool off
Check/orahome/cat. log after execution to see if there are any unacceptable errors.



8. Create sqlplus attributes and help and USERS tablespace
SQL> connect system/iamwangnc
SQL> @? /Sqlplus/admin/pupbld. SQL
SQL> @? /Sqlplus/admin/help/hlpbld. SQL helpus. SQL
SQL> connect/as sysdba
SQL> CREATE TABLESPACE USERS LOGGING DATAFILE '/orahome/oradata/WENDING/users01.dbf' SIZE 100 M REUSE AUTOEXTEND ON NEXT 10 m MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
SQL> ALTER DATABASE DEFAULT TABLESPACE USERS;



9. Change to archive mode and restart
SQL> shutdown immediate;
SQL> connect/as sysdba
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
Recompile all failed processes:
SQL> execute utl_recomp.recomp_serial ();



10. Create and configure EM (optional ):
SQL> @? /Sysman/admin/emdrep/SQL/emreposcre/u01/app/oracle/product/10.2.0/db_1 SYSMAN iamwangnc TEMP ON;
SQL> alter user SYSMAN identified by "iamwangnc" account unlock;
SQL> alter user DBSNMP identified by "iamwangnc" account unlock;
SQL> host emca-config dbcontrol db-silent-DB_UNIQUE_NAME WENDING-PORT 1521-EM_HOME/u01/app/oracle/product/10.2.0/db_1-LISTENER-SERVICE_NAME WENDING. LK-SYS_PWD "iamwangnc"-sid wending-ORACLE_HOME/u01/app/oracle/product/10.2.0/db_1-DBSNMP_PWD "iamwangnc"-HOST "vmone"-LISTENER_OH/u01/app/ oracle/product/10.2.0/db_1-LOG_FILE/orahome/emConfig. log-SYSMAN_PWD "iamwangnc ";

The database has been created!

-- End --

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.