Oracle8i
Enterprise Edition for Windows NT Getting Started
Release 8.1.5 for Windows NT A68694-01 |
|
This chapter describes how to create a database automatically using Oracle Database Configuration Assistant. It also describes how to create a database manually using command line tools and the BUILD_DB.SQL script.
A name is associated with a database at "CREATE DATABASE" time and stored in its control files. If the database keyword is provided in the CREATE DATABASE statement, that value becomes the name for that database. If not, the program uses the value of the DB_NAME parameter in the INIT.ORA file.
If you attempt to mount two Oracle8i databases with the same database name, you receive the following error during the second mount:
ORA-01102: cannot mount database in EXCLUSIVE modeIf there are two or more Oracle8i databases on the same computer, but located in different Oracle homes, the following rules apply: To change the name of an existing database, you must use the CREATE CONTROLFILE statement to recreate your control file(s) and specify a new database name. This restriction only exists for Oracle8i instances. Any Oracle7 instances running simultaneously with an Oracle8i instance are not subject to this restriction.
Note: The directory path examples in this chapter follow Optimal Flexible Architecture (OFA) guidelines (for example, ORACLE_BASE\ORACLE_HOME\RDBMS\ADMIN). If you specified non-OFA compliant directories during installation, your directory paths will differ. See "OFA and Multiple Oracle Home Configurations" for information. |
UNC is a PC format for specifying the location of resources on a local area network. UNC uses the following format:
\\server-name\shared-resource-pathname
For example, to access the file SYSTEM01.DBF in the directory C:\ORACLE\ORA81\ORADATA\ORCL on the shared server ARGON, you reference the file as:
\\ARGON\ORACLE\ORA81\ORADATA\ORCL\SYSTEM01.DBF
Note that the location of archive log files cannot be specified using UNC. If you set the LOG_ARCHIVE_DEST initialization parameter to a UNC specification, the database does not start and you receive the following errors:
ORA-00256: error occurred in translating archive text string '\meldell\rmdrive' ORA-09291: sksachk: invalid device specified for archive destination OSD-04018: Unable to access the specified directory or device O/S-Error: (OS 2) The system cannot find the file specifiedEnsure that you set the LOG_ARCHIVE_DEST initialization parameter to a mapped drive.
Note: An ORA-00256 error also occurs if you enter: Control files required the additional backslashes for release 8.0.4, but redo files and data files did not. |
There are slight differences between each option:
If you selected Hybrid, you do not need to import a sample schema; one is already provided with your database.
To import an OLTP or DSS sample schema into your Oracle database:
The Modify a Database option enables you to perform the following procedures:
Multi-threaded server (MTS) support lets multiple client user processes to share a small number of server processes. Many client users can connect to a dispatcher process. The dispatcher process then routes client requests to the next available shared server process. No dedicated server process exists for each remaining user process associated with the client user process for the duration of the connection. Instead, inactive server processes are "recycled" and used as needed. This reduces system overhead and enables you to increase the number of supported users.
Additional
Information:
See "Multi-Threaded Server Support" in Chapter 6. In addition, see the following guides: |
The following table summarizes the steps involved in creating a new database for each of these database creation scenarios. Each step is explained in detail in the following subsections.
In this example, you will copy an existing database (the starter database with a SID of ORCL located in the C:\ORACLE\ORADATA\ORCL directory) to a new database with a database name and SID of PROD located in the C:\ORACLE\ORADATA\PROD directory.
You will delete the starter database ORCL after you have created the PROD database.
Note: In this example, ORACLE_BASE is C:\ORACLE. See Chapter 4, "Multiple Oracle Homes and Optimal Flexible Architecture" for more information on ORACLE_BASE. |
You can invoke the Export Utility by using either parameter mode or interactive mode. However, parameter mode is the recommended mode. Interactive mode provides less functionality than parameter mode and exists for backward compatibility only.
Enter only the command EXP SYSTEM/PASSWORD to begin an interactive session and let the Export Utility prompt you for the information it needs.
See Oracle8i Utilities for more information on using the Export Utility.
To export all data from an existing database to a new database:
Deleting database files is only required when you want to copy an existing database to a new database to replace the old database. In the following example, you delete the database files of the starter database ORCL.
To delete database files:
C:\> ORADIM -SHUTDOWN -SID ORCL -USRPWD PASSWORD
-SHUTTYPE INST
-SHUTMODE I
If you are using the starter database ORCL as the basis for your new database, copy:
and modify the file as described in this section.C:\ORACLE\ADMIN\ORCL\PFILE\INIT.ORAtoC:\ORACLE\ADMIN\PROD\PFILE\INIT.ORA
If you do not have an existing database on your system, you cannot copy an initialization parameter file to use as the basis for your new INIT.ORA file. However, you can use the sample initialization parameter file INITSMPL.ORA provided in the ORACLE_BASE\ADMIN\SAMPLE\PFILE directory as the basis for the INIT.ORA file for the PROD database.
If you use INITSMPL.ORA as the basis for the INIT.ORA file, you must modify the following initialization parameters in the INIT.ORA file, or you will not be able to start the PROD database:
Modifying the DB_FILES initialization parameter is recommended to optimize performance.Initialization Parameter | Modification Instructions. |
---|---|
DB_NAME |
This parameter indicates the name of the database, and must match the name used in the CREATE DATABASE statement in "Putting the CREATE DATABASE Statement in a Script", later in this section. You give a unique database name to each database. You can use up to eight characters for a database name. The name does not need to match the SID of the database service. DB_NAME=PROD.DOMAIN |
INSTANCE_NAME |
INSTANCE_NAME=PROD.DOMAIN |
SERVICE_NAMES |
SERVICE_NAMES=PROD.DOMAIN |
CONTROL_FILES |
This parameter lists the control files of the database. You do not have the control files on your file system at this point, because the control files are created when you run the CREATE DATABASE statement. Ensure that you specify the complete path and file name, including drive letter. CONTROL_FILES = ("C:\ORACLE\ORADATA\PROD\CONTROL01.CTL", "C:\ORACLE\ORADATA\PROD\CONTROL02.CTL") |
BACKGROUND_DUMP_DEST |
BACKGROUND_DUMP_DEST = C:\ORACLE\ADMIN\PROD\BDUMP |
USER_DUMP_DEST |
USER_DUMP_DEST = C:\ORACLE\ADMIN\PROD\UDUMP |
DB_FILES |
Set this parameter to the same number as the value of the MAXDATAFILES option of the CREATE DATABASE statement. The value of 100 is used for this example. DB_FILES=100 |
Additional
Information:
See Appendix B, "Oracle8i Database Specifications for Windows NT" and Oracle8i Reference for information on other initialization parameters that you may want to add or modify. |
You only need to create and start an Oracle service if you want to do one of the following:
Before you create the database, first create a Windows NT service to run the database. This service is the Oracle database process, ORACLE.EXE, installed in the form of a Windows NT service.
Use ORADIM to create the service. After it has been created, the service starts automatically. See "Using ORADIM to Administer an Oracle Instance" for information on how to use ORADIM.
To create and start an Oracle service:
Open the BUILD_DB.SQL script located in C:\ORACLE\ORA81\RDBMS\ADMIN and save it as BUILD_PROD.SQL.
This file becomes the basis for your script.
To prepare the CREATE DATABASE script:
Make the following changes to the BUILD_PROD.SQL script.
-- -- This file must be run out of the directory containing the -- initialization file. startup nomount pfile=C:\Oracle\ADMIN\SAMPLE\pfile\initsmpl.ora -- Create database create database SAMPLE controlfile reuse logfile 'C:\Oracle\ORADATA\SAMPLE\redo01.log' size 1M reuse, 'C:\Oracle\ORADATA\SAMPLE\redo02.log' size 1M reuse, 'C:\Oracle\ORADATA\SAMPLE\redo03.log' size 1M reuse, 'C:\Oracle\ORADATA\SAMPLE\redo04.log' size 1M reuse datafile 'C:\Oracle\ORADATA\SAMPLE\system01.dbf' size 10M reuse autoextend on next 10M maxsize 200M character set WE8ISO8859P1; create rollback segment rb_temp storage (initial 100 k next 250 k); -- Create additional tablespaces ... -- USERs: Create user sets this as the default tablespace -- TEMP: Create user sets this as the temporary tablespace -- RBS: For rollback segments create tablespace users datafile 'C:\Oracle\ORADATA\SAMPLE\users01.dbf' size 3M reuse autoextend on next 5M maxsize 150M; create tablespace rbs datafile 'C:\Oracle\ORADATA\SAMPLE\rbs01.dbf' size 5M reuse autoextend on next 5M maxsize 150M; create tablespace temp datafile 'C:\Oracle\ORADATA\SAMPLE\temp01.dbf' size 2M reuse autoextend on next 5M maxsize 150M; create tablespace oem_repository datafile 'C:\Oracle\ORADATA\SAMPLE\oemrep01.dbf' size 3M reuse autoextend on next 5M maxsize 150M; create tablespace indx; datafile 'C:\Oracle\ORADATA\SAMPLE\indx01.dbf' size 2M reuse autoextend on next 5M maxsize 150M; -- next 5M maxsize 150M; alter rollback segment rb_temp online; -- Change the SYSTEM users' password, default tablespace and -- temporary tablespace. alter user system temporary tablespace temp; alter user system default tablespace users; -- Create 16 rollback segments. Allows 16 concurrent users with open -- transactions updating the database. This should be enough. create public rollback segment rb1 storage(initial 50K next 250K) tablespace rbs; create public rollback segment rb2 storage(initial 50K next 250K) tablespace rbs; create public rollback segment rb3 storage(initial 50K next 250K) tablespace rbs; create public rollback segment rb4 storage(initial 50K next 250K) tablespace rbs; create public rollback segment rb5 storage(initial 50K next 250K) tablespace rbs; create public rollback segment rb6 storage(initial 50K next 250K) tablespace rbs; create public rollback segment rb7 storage(initial 50K next 250K) tablespace rbs; create public rollback segment rb8 storage(initial 50K next 250K) tablespace rbs; create public rollback segment rb9 storage(initial 50K next 250K) tablespace rbs; create public rollback segment rb10 storage(initial 50K next 250K) tablespace rbs; create public rollback segment rb11 storage(initial 50K next 250K) tablespace rbs; create public rollback segment rb12 storage(initial 50K next 250K) tablespace rbs; create public rollback segment rb13 storage(initial 50K next 250K) tablespace rbs; create public rollback segment rb14 storage(initial 50K next 250K) tablespace rbs; create public rollback segment rb15 storage(initial 50K next 250K) tablespace rbs; create public rollback segment rb16 storage(initial 50K next 250K) tablespace rbs;
You will run this script at the Server Manager prompt in "Creating a Database".
Additional
Information:
If creating a tablespace in a raw partition, modify the data file names with a naming convention of \\.\DRIVE_LETTER: or \\.\SYMBOLIC LINK NAME. See Appendix F, "Storing Tablespaces on Raw Partitions" for more information on storing tablespaces in raw partitions. |
To use the BUILD_PROD.SQL script to create a database:
If the database is created successfully, the instance is started and the message Statement processed appears numerous times.
If you receive any errors, there are three possible causes, as illustrated below.
You must correct these problems before attempting to recreate a database.
SVRMGR> @C:\ORACLE\ORA81\RDBMS\ADMIN\CATALOG.SQL;
Note: You may see messages such as ORA-01432: public synonym to be dropped does not exist while the CATALOG.SQL, CATPROC.SQL, and CATREP.SQL scripts are running. These are information messages and are intended to occur while creating a new database. If you see any unusual errors while examining the BUILD_PROD.LOG log file in step 10, see Oracle8i Error Messages for suggested actions. |
You can import the full export created in "Exporting an Existing Database" into the new database.
You can also invoke the Import Utility, using parameter mode or interactive mode. Parameter mode is recommended, because interactive mode provides less functionality. Interactive mode exists solely for backward compatibility.
C:\> IMP SYSTEM/PASSWORD FILE=MYEXP.DMP FULL=Y LOG=MYEXP.LOG
C:\> IMP SYSTEM/PASSWORD
Enter only the command IMP SYSTEM/PASSWORD to begin an interactive session and let the Import Utility prompt you for the information it needs.
See Oracle8i Utilities for more information on using the Import Utility.
To import a database:
If this is the first database on the system or if you want to make the new database the default database, you must make a change in the registry.
Additional
Information:
See Appendix C, "Oracle 8i Configuration Parameters and the Registry" for more information on the subkey locations for multiple Oracle homes. |
To create the ORACLE_SID parameter:
A string editor dialog box appropriate for the data type appears:
WARNING: If anything goes wrong while operating the new database without a backup, you must repeat the database creation procedure. Back up your database now to prevent such damage. |
To back up the new database:
WARNING: Although ORADIM returns the prompt immediately, you must wait for the database and the service to stop completely before continuing to Step 2. Wait until the Control Panel indicates the OracleServicePROD service has stopped. If you do not do this, the backup may be useless as it was taken while data was being written to the data files. |
Additional
Information:
See Chapter 12, "Backing Up and Recovering Database Files", Oracle8i Concepts, Oracle8i Backup and Recovery Guide, and Oracle8i Administrator's Guide for more information on archiving and backup/recovery.
|
You only need to use ORADIM if you are manually creating, deleting, or modifying databases. Oracle Database Configuration Assistant is an easier tool to use for this purpose.
Note:
This is the only place in the product information set where you will find information on ORADIM |
ORADIM and Oracle Database Configuration Assistant perform similar tasks. The following table compares what you can do with these tools.
ORADIM | Oracle Database Configuration Assistant |
---|---|
The following sections describe the ORADIM commands and parameters. Note that each command is preceded by a dash (-).
To create an instance... | ||
Use this syntax: | ORADIM
-NEW -SID SID | -SRVC SERVICE_NAME [-INTPWD INTERNAL_PWD]
- SHUTTYPE SRVC | INST | SRVC, INST
[-MAXUSERS NUMBER][-STARTMODE AUTO | MANUAL][-PFILE FILENAME] |
|
Example to create an instance called PROD: | C:\> ORADIM -NEW -SID PROD -INTPWD MYPASSWORD1 -STARTMODE AUTO -PFILE C:\ORACLE\ADMIN\PROD\PFILE\INIT.ORA | |
Syntax description: | Indicates that you want to create a new instance. This is a mandatory parameter. | |
-
|
The name of the instance you want to create. You must specify either this parameter or the -SRVC parameter described below. |
|
-
|
The name of the service you want to create (OracleServiceSID). You must specify either this parameter or the -SID parameter described above. | |
-
|
The password for the INTERNAL account. The -INTPWD option is not required. If you do not specify it, operating system authentication is used, and no password is required. See "Automatically Enabling Operating System Authentication During Installation" for a description of features. | |
-
|
The number of users defined in the password file. The default is 5. | |
|
Indicates whether to start the instance automatically or manually at startup. The default setting is MANUAL. | |
|
The INIT.ORA file to be used with this instance. Ensure that you specify the complete pathname of this file, including drive letter. | |
|
Indicates whether to stop the service or the instance. Both can be specified. This is a mandatory parameter. |
To modify an instance... | ||
Use this syntax: |
ORADIM -EDIT -SID SID
[-NEWSID NEWSID] [-INTPWD INTERNAL_PWD]
[-STARTMODE AUTO | MANUAL][-PFILE FILENAME] |
|
Example to modify an instance called PROD: |
C:\> ORADIM -EDIT -SID PROD -NEWSID LYNX -INTPWD MYCAT123 -STARTMODE AUTO -PFILE C:\ORACLE\ADMIN\LYNX\PFILE\INIT.ORA |
|
Note: |
You can modify an existing instance, in this example PROD, to change such values as the instance name, the password, the startup mode, and the number of users. |
|
Syntax description: | Indicates that you want to modify an instance. This is a mandatory parameter. | |
- | The name of the instance you want to modify. This is a mandatory parameter. | |
- | The new instance name. This is an optional parameter. | |
- | The password for
the INTERNAL account.
Note: This parameter cannot be used to change the password, as it does not overwrite the existing password file. It can only create a new password file when none already exists. To create a new password file, use ORAPWD, or delete the Oracle8i services (this action implicitly deletes the associated password file) and then recreate the Oracle8i services (this action implicitly creates the associated password file). See "Password Utility (ORAPWD)" in Chapter 3, "Database Tools Overview". |
|
- | Indicates whether to start the instance automatically or manually at startup. The default setting is MANUAL. | |
- | The INIT.ORA file to be used with this instance. Ensure that you specify the complete pathname of this file, including drive letter. |