Oracle DBA manually creates a database through command line

Source: Internet
Author: User
When creating an Oracle database, we use dbca in most cases, which is simple, convenient, and more automatic. <br/> today we will try to create a database manually using the command line method, it has a special flavor. <Br/> Oracle software version: 10gr2 <br/> operating system version: Win XP SP3 <br/> destination data Sid: t02 </P> <p> (1) create dump and parameter file folders: <br/> D: \ oracle \ product \ 10.2.0 \ admin \ t02 <br/> D: \ oracle \ product \ 10.2.0 \ admin \ t02 \ adump <br/> D: \ oracle \ product \ 10.2.0 \ admin \ t02 \ bdump <br/> D: \ oracle \ product \ 10.2.0 \ admin \ t02 \ cdump <br/> D: \ oracle \ product \ 10.2.0 \ admin \ t02 \ dpdump <br/> D: \ oracle \ product \ 10.2.0 \ admin \ t02 \ pfile <br/> D: \ oracle \ product \ 10.2.0 \ admin \ t02 \ U Dump </P> <p> (2) create a folder for datafile: <br/> D: \ oracle \ product \ 10.2.0 \ oradata \ t02 </P> <p> (3) create a parameter file. You can copy the file from another database before modifying it, note Directory change: <br/> D: \ oracle \ product \ 10.2.0 \ db_1 \ database \ initt02.ora </P> <p> ##################### ######################################## ################ <br/> # copyright (c) 1991,200 1, 2002 by Oracle Corporation <br/> ################################ ######################################## ##### # </P> <p> ################################ ########## <br/> # NLS <br/> ################### ####################### <br/> nls_language = "American" <br/> nls_territory =" america "</P> <p> ############################### ########### <br/> # SGA memory <br/> ################# ######################### <br/> sga_target = 290455552 </P> <p> ######################################## ###< br/> # Job Queues <br/> ############## ########################### <Br/> job_queue_processes = 10 </P> <p> ##################################### ######< br/> # shared server <br/> ####################### ################### <br/> dispatchers = "(Protocol = TCP) (service = t02xdb) "</P> <p> ################################ ########## <br/> # miscellaneous <br/> ################### ######################## <br/> compatible = 10.2.0.1.0 </P> <p> ## ################ #########################< Br/> # security and auditing <br/> ### ######################################## <br/> audit_file_dest = D: \ oracle \ product \ 10.2.0/admin/t02/adump <br/> remote_login_passwordfile = exclusive </P> <p> ############## ############################< br/> # sort, hash joins, bitmap indexes <br/> ################################## ######### <br/> pga_aggregate_target = 96468992 </P> <p> ############# ############################# <Br/> # Database identification <br/ ####################################### #### <br/> db_domain = "" <br/> db_name = t02 </P> <p> ############## #############################< br/> # file configuration <br/> ######################################## ### <br/> control_files = ("D: \ oracle \ product \ 10.2.0/oradata/t02/\ control01.ctl "," d: \ oracle \ product \ 10.2.0/oradata/t02/\ control02.ctl ", "D: \ oracle \ product \ 10.2.0/oradata/t02/\ control03.ctl") <br/> db_recovery_file_dest = D: \ oracle \ product \ 10.2.0/flash_recovery_area <br/> db_recovery_file_dest_size = 2147483648 </P> <p> ################## ######################### <br/> # cursors and library cache <br/> ## ######################################## # <br/> open_cursors = 300 </P> <p> ######################### ################# <br/> # system managed und O and rollback segments <br/> ################################ ########## <br/> undo_management = auto <br/> undo_tablespace = undotbs1 </P> <p> ######## ###################################< br/> # diagnostics and Statistics <br/> ################################# ######### <br/> background_dump_dest = D: \ oracle \ product \ 10.2.0/admin/t02/bdump <br/> core_dump_dest = D: \ oracle \ product \ 10.2.0/admin/t02/cdump <br/> User _ Dump_dest = D: \ oracle \ product \ 10.2.0/admin/t02/udump </P> <p> ##################### ###################### <br/> # processes and sessions <br/> ###### ##################################### <br/> processes = 150 </P> <p> ############################# ############## <br/> # cache and I/O <br/> ############ ############################## <br/> db_block_size = 8192 <br /> db_file_multiblock_read_count = 16 </P> <p> (4) create a password file: <br /> Orapwd file = D: \ oracle \ product \ 10.2.0 \ db_1 \ database \ pwdt02.ora Password = Oracle entries = 2 </P> <p> (5) create an instance (a service is registered in Windows): <br/> oradim-New-Sid t02 </P> <p> (6) Start the database to the nomount status, set oracle_sid: <br/> set oracle_sid = t02 <br/> sqlplus/As sysdba <br/> startup nomount </P> <p> (7) to create a database: <br/> select status from V $ instance; <br/> ed <br/> fill in the following creation script content, save the content, enter a forward slash (/), and press enter to execute: <br/> Create Database t02 <br/> datafile 'd: \ or ACLE \ product \ 10.2.0 \ oradata \ t02 \ system01.dbf 'size 100 m reuse autoextend on next 10 m maxsize unlimited <br/> extent management local <br/> sysaux datafile 'd: \ oracle \ product \ 10.2.0 \ oradata \ t02 \ sysaux01.dbf' <br/> size 100 m reuse autoextend on next 10 m maxsize unlimited <br/> default temporary tablespace temp <br/> tempfile 'd: \ oracle \ product \ 10.2.0 \ oradata \ t02 \ temp01.dbf 'size 100 m reuse autoextend on Next 10 m maxsize unlimited <br/> undo tablespace "undotbs1" -- note that the Undo tablespace here must correspond to the parameter file <br/> datafile 'd: \ oracle \ product \ 10.2.0 \ oradata \ t02 \ undotbs01.dbf 'size 100 m reuse autoextend on next 10 m maxsize unlimited <br/> default tablespace users <br/> datafile 'd: \ oracle \ product \ 10.2.0 \ oradata \ t02 \ users01.dbf 'size 100 m reuse autoextend on next 10 m maxsize unlimited <br/> logfile <br/> group 1 ('d: \ oracle \ pro Duct \ 10.2.0 \ oradata \ t02 \ redo01.log ') Size 10 m, <br/> group 2 ('d: \ oracle \ product \ 10.2.0 \ oradata \ t02 \ redo02.log ') size 10 m, <br/> group 3 ('d: \ oracle \ product \ 10.2.0 \ oradata \ t02 \ redo03.log ') size 10 m <br/> Character Set al32utf8 <br/> National Character Set al16utf16 <br/> user SYS identified by Oracle <br/> User system identified by Oracle <br/> /</P> <p> now the database can be opened, however, basic data dictionaries (such as dba_objects and dba_tablespa) are still missing. CES, etc.) and <br/> basic built-in programs (such as dbms_output and dbms_session). Next we will create these objects. </P> <p> (8) create a data dictionary: <br/> @ D: \ oracle \ product \ 10.2.0 \ db_1 \ RDBMS \ admin \ catalog. SQL; </P> <p> (9) create a built-in program: <br/> @ D: \ oracle \ product \ 10.2.0 \ db_1 \ RDBMS \ admin \ catproc. SQL; </P> <p> (10) Create Scott Schema (Scott needs to use users tablespace): <br/> @ D: \ oracle \ product \ 10.2.0 \ db_1 \ RDBMS \ admin \ Scott. SQL; </P> <p> (11) Compile the product user profile (which must be executed by the System user): <br/> conn system/Oracle <br/> @ D: \ oracle \ product \ 10.2.0 \ db_1 \ sqlplus \ admin \ pupbld. SQL; </P> <p> (12) configure the listener: <br/> D: \ oracle \ product \ 10.2.0 \ db_1 \ Network \ ADMIN </P> <p> listener. ora <br/> after the preceding steps, the system automatically adds a port (1522) to the existing listener, as shown below: <br/> (in fact, only one port of 1521 can connect two databases at the same time. <Br/> This 1521 record exists because the local machine already has a library t01 before creating the Test Library (t02) <br/> listener = <br/> (description_list = <br/> (description = <br/> (address = (Protocol = IPC) (Key = extproc1 )) <br/> (address = (Protocol = TCP) (host = PC1255-20110528) (Port = 1521) <br/> (address = (Protocol = TCP) (host = PC1255-20110528) (Port = 1522) <br/>) </P> <p> tnsnames. ora <br/> if we want to use TNS for connection, we also need to use tnsnames. add the following configuration to ora: <br/> (if no 1522 rows are generated in the previous step, change 1522 to 1521 here) <br/> t02 = <br/> (description = <br/> (address = (Protocol = TCP) (host = PC1255-20110528) (Port = 1522 )) <br/> (CONNECT_DATA = <br/> (Server = dedicated) <br/> (SERVICE_NAME = t02) <br/>) </P> <p> (13) Verify with Scott: <br/> sqlplus Scott/tiger @ t02 <br/> select * from Dept; </P> <p> (14) Create an Enterprise Manager (EM ): <br/> emca-config dbcontrol DB-repos create </P> <p> t0nsha (liaodunxia at gmail dot com) <br/> 20110714 @ Shanghai <br/>
 

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.