Creating Oracle Databases

Source: Internet
Author: User
Tags character set command line manual log connect reserved create database sqlplus
oracle| Create | data | database

Creating Oracle Databases
Database name: MyDB
1: Copy an already existing database directory D:\Oracle\product\10.1.0\Db_1\admin\sample
To the D:\Oracle\product\10.1.0\admin directory, renamed MyDB,
Delete \mydb\pfile\initsmpl.ora Because this parameter file is older and is copied from the following directory
A parameter file D:\Oracle\product\10.1.0\admin\orcl\pfile\init.ora
Place the file under \mydb\pfile, change the name to Initmydb.ora, and set the following parameters:
db_domain=zhiqiao.com.cn
Db_name=mydb
Instance_name=mydb
control_files= ("D:\oracle\product\10.1.0\oradata\mydb\control01.ctl", "D:\oracle\product\10.1.0\oradata\mydb\c Ontrol02.ctl "," D:\oracle\product\10.1.0\oradata\orcl\control03.ctl ")
Background_dump_dest=d:\oracle\product\10.1.0\admin\mydb\bdump
Core_dump_dest=d:\oracle\product\10.1.0\admin\mydb\cdump
User_dump_dest=d:\oracle\product\10.1.0\admin\mydb\udump

2: Create a parameter file that is read directly when the database is started in D:\Oracle\product\10.1.0\Db_1\database
Initmydb.ora content for ifile= ' D:\Oracle\product\10.1.0\admin\mydb\pfile '

3: Use the ORAPWD command to create a database with SYSDBA permissions user password Word file Pwdmydb.ora,
The user can manage the startup and shutdown of the database, and its storage directory is:
D:\Oracle\product\10.1.0\Db_1\database
On the system command line, enter the following command to create the password file
C:\>orapwd File=d:\oracle\product\10.1.0\db_1\database\pwdmydb.ora
Password=mydb entries=2


4: Create an instance management service in the service table through the instance Management command, set the startup mode to Manual
C:\>oradim-new-sid Mydb-startmode Manual
-pfile "D:\oracle\product\10.1.0\admin\prod\pfile\initmydb.ora"
----"The strange thing is that the Service Management window appears as startup, but shutdown error?
C:\>oradim-shutdown-sid Mydb-usrpwd MyDB
Ora-01012:not logged on
----' Started an error
C:\>oradim-startup-sid Mydb-usrpwd MyDB
Ora-01078:failure in processing system parameters
Lrm-00109:could not open parameter file
' D:\Oracle\product\10.1.0\admin\mydb\pfile '
-----"because it was not created SPFile so specify here
C:\>oradim-startup-sid Mydb-usrpwd MyDB
-pfile "D:\oracle\product\10.1.0\admin\mydb\pfile\initmydb.ora"
Ora-00205:error in identifying Controlfile, check alert log for more info
Cause of error in D:\Oracle\product\10.1.0\admin\mydb\bdump\alert_mydb.log
The general meaning is that the control file could not be found, I think it should be opened in Nomount way, but Oradim did not provide this
option, the Sqlplus is started.

C:\>sqlplus/nolog

Sql*plus:release 10.1.0.2.0-production on Wednesday April 11 10:49:13 2007

Copyright (c) 1982, Oracle. All rights reserved.

Sql> Connect/as SYSDBA
ERROR:
Ora-12560:tns:protocol Adapter Error


Sql> Connect Sys/mydb as Sysdba
ERROR:
Ora-12560:tns:protocol Adapter Error


Sql> exit

C:\>set Oracle_sid=mydb

C:\>sqlplus/nolog

Sql*plus:release 10.1.0.2.0-production on Wednesday April 11 10:50:21 2007

Copyright (c) 1982, Oracle. All rights reserved.

Sql> Conn Sys/mydb as Sysdba
Connected.

Sql> Startup Nomount
Ora-01078:failure in processing system parameters
Lrm-00109:could not open parameter file ' D:\Oracle\product\10.1.0\admin\mydb\pfile '

sql> startup Nomount pfile= "D:\oracle\product\10.1.0\admin\mydb\pfile\initmydb.ora"
Ora-01081:cannot start already-running Oracle-shut it down

sql> shutdown
Ora-01507:database not mounted


ORACLE instance shut down.

sql> startup Nomount pfile= "D:\oracle\product\10.1.0\admin\mydb\pfile\initmydb.ora"
ORACLE instance started.

Total System Global area 171966464 bytes
Fixed Size 787988 bytes
Variable Size 145750508 bytes
Database buffers 25165824 bytes
Redo buffers 262144 bytes

----"Because each time you want to specify Pfile, you can create a
C:\>sqlplus/nolog

Sql*plus:release 10.1.0.2.0-production on Wednesday April 11 11:02:57 2007

Copyright (c) 1982, Oracle. All rights reserved.

Sql> Conn Sys/mydb as Sysdba
Connected to a idle instance.
Sql> create SPFile from Pfile;
Create SPFile from Pfile
*
ERROR at line 1:
Ora-01078:failure in processing system parameters
Lrm-00113:error when processing file
' D:\Oracle\product\10.1.0\admin\mydb\pfile '
Lrm-00109:could not open parameter file
' D:\Oracle\product\10.1.0\admin\mydb\pfile '

----The cause of the error above is the second step, which ifile= "... \initmydb.ora".
Sql> create SPFile from Pfile;
File created.

----"Restart, no Pfile specified.
Sql> Startup Nomount
ORACLE instance started.
......

sql> shutdown Immediate
Ora-01507:database not mounted
ORACLE instance shut down.

----"After restarting the machine, the ORCL database always appears to be started, MyDB is not started
In this case ORCL is actually an idle process, the database Nomount phase, MyDB does not start the process,
The following error occurs when you are connecting to MyDB:
Sql> Conn Sys/mydb as Sysdba
ERROR:
Ora-12560:tns:protocol Adapter Error
You can start the Oracleservicemydb from the service Manager to connect.

----The following two operations is a little strange, I created an instance that can not be started using inst, need to use SRVC
C:\>oradim-startup-sid Mydb-starttype inst-usrpwd MyDB
Ora-12560:tns:protocol Adapter Error

C:\>oradim-startup-sid Mydb-starttype srvc-usrpwd MyDB

5: Create a database
sql> CREATE DATABASE MyDB
2 logfile
3 Group 1
4 (' D:\oracle\product\10.1.0\oradata\mydb\redo11.log ',
5 ' d:\oracle\product\10.1.0\oradata\mydb\redo12.log ') size 10m,
6 Group 2
7 (' D:\oracle\product\10.1.0\oradata\mydb\redo21.log ',
8 ' d:\oracle\product\10.1.0\oradata\mydb\redo22.log ') size 10m
9 datafile ' d:\oracle\product\10.1.0\oradata\mydb\system01.dbf ' size 100m
Autoextend on next 10m maxsize unlimited extent management Local
One sysaux datafile ' d:\oracle\product\10.1.0\oradata\mydb\sysaux01.dbf ' size 50m
Undo tablespace undotbs01 DataFile ' d:\oracle\product\10.1.0\oradata\mydb\undotbs1.dbf ' size 20m
The default temporary tablespace temp
Tempfile ' d:\oracle\product\10.1.0\oradata\mydb\temp01.dbf ' size 10m
Default Tablespace users
DataFile ' d:\oracle\product\10.1.0\oradata\mydb\users01.dbf ' size 10m
17* Character Set ZHS16GBK
Create DATABASE MyDB
*
ERROR at line 1:
Ora-01092:oracle instance terminated. Disconnection forced

----"View Alert_mydb.log found that the error occurred after creating the UNDOTBS1.DBF,
Wed APR 11 13:48:19 2007
CREATE UNDO tablespace UNDOTBS01 datafile ' d:\oracle\product\10.1.0\oradata\mydb\undotbs1.dbf ' size 20m

ORA-30012 signalled during:create UNDO tablespace UNDOTBS01 datafile ' D:\ora ...
Wed APR 11 13:48:21 2007
Errors in file d:\oracle\product\10.1.0\admin\mydb\udump\mydb_ora_828.trc:
Ora-00604:error occurred at recursive SQL level 1
Ora-30012:undo tablespace ' UNDOTBS1 ' does not exist or of wrong type

Why does----say UNDOTBS1 doesn't exist? View the parameter file and find two lines
Undo_management=auto
Undo_tablespace=undotbs1

----"Then delete some of the files that you just created, and then modify the CREATE DATABASE statement to
Sql> Conn Sys/mydb as Sysdba
Connected to a idle instance.
Sql> Startup Nomount
ORACLE instance started.

----"This was originally a successful creation, but I am in order to record the cause of the error, will create a good database file all deleted again,
And then, like the following, it's wrong again.
Total System Global area 171966464 bytes
Fixed Size 787988 bytes
Variable Size 145750508 bytes
Database buffers 25165824 bytes
Redo buffers 262144 bytes
Sql> L12
12* undo tablespace undotbs01 DataFile ' d:\oracle\product\10.1.0\oradata\mydb\undotbs1.dbf ' size 20m
Sql> c/undotbs01/undotbs1/
12* undo tablespace undotbs1 DataFile ' d:\oracle\product\10.1.0\oradata\mydb\undotbs1.dbf ' size 20m
Sql> Run
......
Create DATABASE MyDB
*
ERROR at line 1:
Ora-01092:oracle instance terminated. Disconnection forced

----"is still the same mistake, but the reason for the mistake is different.
Wed APR 11 13:55:39 2007
Errors in file d:\oracle\product\10.1.0\admin\mydb\udump\mydb_ora_1344.trc:
Ora-01501:create DATABASE failed
Ora-01991:invalid password file ' D:\oracle\product\10.1.0\Db_1\DATABASE\PWDmydb.ORA '


----"Display password file is not available, estimate is related to the deletion just now, recreate the password file.
See Step Three
----the execution of the statement creating the database was successful.


----"When the database is created, it is automatically in open state, all v$ ... Can be queried, but others are not, such as:
Sql> select * from Dba_users;
SELECT * FROM Dba_users
*
ERROR at line 1:
Ora-00942:table or view does not exist

----"The way to solve the above problem is to load the usual data dictionary package
Sql>@d:\oracle\product\10.1.0\db_1\rdbms\admin\catalog.sql

----"Problems with system user connections
Sql> Conn System/zhiqiao
ERROR:
Ora-01017:invalid Username/password; Logon denied
Warning:you are no longer connected to ORACLE.

Sql> Conn Sys/mydb as Sysdba
Connected.

Sql> Grant connect to system identified by MyDB;
Grant succeeded.

Sql> Conn System/mydb
ERROR:
Ora-06550:line 1, Column 7:
Pls-00201:identifier ' Dbms_application_info. Set_module ' must be declared
Ora-06550:line 1, Column 7:
Pl/sql:statement ignored
Error Accessing Package Dbms_application_info
Connected.
----"There was an error, but it was connected, connected ORCL, or created with a wizard without this problem.
Sql> Show user;
USER is "SYSTEM"

----In addition to the data dictionary package, the following packages are usually loaded
1:pl/sql Package Catproc.sql
2: Remote Data replication Catrep.sql
3:java Package Initjvm.sql
4: System environment files, must be logged on to the systems user Db_1\sqlplus\admin\pupbld.sql

A lot of errors occurred while loading the PL/SQL package, the table or view does not exist, and I don't know why.




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.