Oracle DBA manually creates a database through command line

Source: Internet
Author: User

  1. When creating an Oracle database, we use dbca in most cases, which is simple, convenient, and automated;
  2. Today, we will try to create a database manually using the command line method.
  3. Oracle software version: 10gR2
  4. Operating system version: win xp sp3
  5. Destination data sid: t02
  6. (1) create a dump and a folder for parameter files:
  7. D: \ oracle \ product \ 10.2.0 \ admin \ t02
  8. D: \ oracle \ product \ 10.2.0 \ admin \ t02 \ adump
  9. D: \ oracle \ product \ 10.2.0 \ admin \ t02 \ bdump
  10. D: \ oracle \ product \ 10.2.0 \ admin \ t02 \ cdump
  11. D: \ oracle \ product \ 10.2.0 \ admin \ t02 \ dpdump
  12. D: \ oracle \ product \ 10.2.0 \ admin \ t02 \ pfile
  13. D: \ oracle \ product \ 10.2.0 \ admin \ t02 \ udump
  14. (2) create a folder for datafile:
  15. D: \ oracle \ product \ 10.2.0 \ oradata \ t02
  16. (3) create a parameter file. You can copy the file from another database before modifying the file. Note the following:
  17. D: \ oracle \ product \ 10.2.0 \ db_1 \Database\ Initt02.ora
  18. ######################################## ######################################
  19. # Copyright (c) 1991,200 1, 2002ByOracle Corporation
  20. ######################################## ######################################
  21. ######################################## ###
  22. # NLS
  23. ######################################## ###
  24. Nls_language ="AMERICAN"
  25. Nls_territory ="AMERICA"
  26. ######################################## ###
  27. # SGA Memory
  28. ######################################## ###
  29. Sga_target = 290455552
  30. ######################################## ###
  31. # Job Queues
  32. ######################################## ###
  33. Job_queue_processes = 10
  34. ######################################## ###
  35. # Shared Server
  36. ######################################## ###
  37. Dispatchers ="(PROTOCOL = TCP) (SERVICE = t02XDB )"
  38. ######################################## ###
  39. # Miscellaneous
  40. ######################################## ###
  41. Compatible = 10.2.0.1.0
  42. ######################################## ###
  43. # SecurityAndAuditing
  44. ######################################## ###
  45. Audit_file_dest = D: \ oracle \ product \ 10.2.0/admin/t02/adump
  46. Remote_login_passwordfile = EXCLUSIVE
  47. ######################################## ###
  48. # Sort, Hash Joins, Bitmap Indexes
  49. ######################################## ###
  50. Pga_aggregate_target = 96468992
  51. ######################################## ###
  52. #DatabaseIdentification
  53. ######################################## ###
  54. Db_domain =""
  55. Db_name = t02
  56. ######################################## ###
  57. # File Configuration
  58. ######################################## ###
  59. 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")
  60. Db_recovery_file_dest = D: \ oracle \ product \ 10.2.0/flash_recovery_area
  61. Db_recovery_file_dest_size = 2147483648
  62. ######################################## ###
  63. # CursorsAndLibrary Cache
  64. ######################################## ###
  65. Open_cursors = 300
  66. ######################################## ###
  67. # System Managed UndoAnd RollbackSegments
  68. ######################################## ###
  69. Undo_management = AUTO
  70. Undo_tablespace = UNDOTBS1
  71. ######################################## ###
  72. # DiagnosticsAnd Statistics
  73. ######################################## ###
  74. Background_dump_dest = D: \ oracle \ product \ 10.2.0/admin/t02/bdump
  75. Core_dump_dest = D: \ oracle \ product \ 10.2.0/admin/t02/cdump
  76. User_dump_dest = D: \ oracle \ product \ 10.2.0/admin/t02/udump
  77. ######################################## ###
  78. # ProcessesAndSessions
  79. ######################################## ###
  80. Processes = 150
  81. ######################################## ###
  82. # CacheAndI/O
  83. ######################################## ###
  84. DB _ block_size = 8192
  85. Db_file_multiblock_read_count = 16
  86. (4) create a password file:
  87. Orapwd file = D: \ oracle \ product \ 10.2.0 \ db_1 \Database\ Pwdt02.oraPassword= Oracle entries = 2
  88. (5) Create an instance (a service will be registered in windows ):
  89. Oradim-new-sid t02
  90. (6) to start the database to the nomount status, you must first set oracle_sid:
  91. SetOracle_sid = t02
  92. Sqlplus/AsSysdba
  93. Startup nomount
  94. (7) Create a database:
  95. SelectStatusFromV $ instance;
  96. Ed
  97. Enter the following creation script content, save the content, enter the forward slash (/), and press enter to execute:
  98. Create DatabaseT02
  99. Datafile'D: \ oracle \ product \ 10.2.0 \ oradata \ t02 \ system01.dbf' Size100 M reuse autoextendOn Next10 M maxsize unlimited
  100. Extent managementLocal
  101. Sysaux datafile'D: \ oracle \ product \ 10.2.0 \ oradata \ t02 \ sysaux01.dbf'
  102. Size100 M reuse autoextendOn Next10 M maxsize unlimited
  103. Default TemporaryTablespaceTemp
  104. Tempfile'D: \ oracle \ product \ 10.2.0 \ oradata \ t02 \ temp01.dbf' Size100 M reuse autoextendOn Next10 M maxsize unlimited
  105. Undo tablespace"UNDOTBS1" -- Note that the undo tablespace corresponds to the parameter file.
  106. Datafile'D: \ oracle \ product \ 10.2.0 \ oradata \ t02 \ undotbs01.dbf' Size100 M reuse autoextendOn Next10 M maxsize unlimited
  107. DefaultTablespace users
  108. Datafile'D: \ oracle \ product \ 10.2.0 \ oradata \ t02 \ users01.dbf' Size100 M reuse autoextendOn Next10 M maxsize unlimited
  109. Logfile
  110. Group1 ('D: \ oracle \ product \ 10.2.0 \ oradata \ t02 \ redo01.log')Size10 M,
  111. Group2 ('D: \ oracle \ product \ 10.2.0 \ oradata \ t02 \ redo02.log')Size10 M,
  112. Group3 ('D: \ oracle \ product \ 10.2.0 \ oradata \ t02 \ redo03.log')Size10 M
  113. Character SetAl32utf8
  114. National Character SetAl16utf16
  115. UserSys identifiedByOracle
  116. UserSystem identifiedByOracle
  117. /
  118. Now the database can be opened, but basic data dictionaries (such as dba_objects and dba_tablespaces) and
  119. Basic built-in programs (such as dbms_output and dbms_session). Next we will create these objects.
  120. (8) create a data dictionary:
  121. @ D: \ oracle \ product \ 10.2.0 \ db_1 \ RDBMS \ ADMIN \ catalog. SQL;
  122. (9) create a built-in program:
  123. @ D: \ oracle \ product \ 10.2.0 \ db_1 \ RDBMS \ ADMIN \ catproc. SQL;
  124. (10) Create scottSchema(Scott needs to use the users tablespace ):
  125. @ D: \ oracle \ product \ 10.2.0 \ db_1 \ RDBMS \ ADMIN \ scott. SQL;
  126. (11) Compile the productUserProfile (which must be executed by the system user ):
  127. Conn system/oracle
  128. @ D: \ oracle \ product \ 10.2.0 \ db_1 \ sqlplus \ admin \ pupbld. SQL;
  129. (12) configure the listener:
  130. D: \ oracle \ product \ 10.2.0 \ db_1 \ NETWORK \ ADMIN
  131. Listener. ora
  132. After the preceding steps, the system automatically adds a port (1522) to the existing listener, as shown below:
  133. (In fact, only one port of 1521 can be connected to two databases at the same time.
  134. This 1521 record exists because the local database t01 exists before the test Library (t02) is created)
  135. LISTENER =
  136. (DESCRIPTION_LIST =
  137. (DESCRIPTION =
  138. (ADDRESS = (PROTOCOL = IPC )(KEY= EXTPROC1 ))
  139. (ADDRESS = (PROTOCOL = TCP) (HOST = PC1255-20110528) (PORT = 1521 ))
  140. (ADDRESS = (PROTOCOL = TCP) (HOST = PC1255-20110528) (PORT = 1522 ))
  141. )
  142. )
  143. Tnsnames. ora
  144. If we want to use tns for connection, we also need to add the following configuration in tnsnames. ora:
  145. (If NO 1522 rows are generated in the previous step, you only need to change 1522 to 1521 here)
  146. T02 =
  147. (DESCRIPTION =
  148. (ADDRESS = (PROTOCOL = TCP) (HOST = PC1255-20110528) (PORT = 1522 ))
  149. (CONNECT_DATA =
  150. (SERVER = DEDICATED)
  151. (SERVICE_NAME = t02)
  152. )
  153. )
  154. (13) Verify with scott:
  155. Sqlplus scott/tiger @ t02
  156. Select*FromDept;
  157. (14) Create an Enterprise Manager (EM ):
  158. Emca-config dbcontrol db-reposCreate
  159. T0nsha (liaodunxiaATGmail DOT com)
  160. 20110714 @ Shanghai

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.