- 创建数据库
-
发布时间:2010-12-02 09:11:43
发布时间:2010-12-02 09:11:43
创建数据库通常使用两种方式: 这是oracle本身的bug,此时可选择“ignore”,数据库建立成功后,以sys用户执行rdbms/admin/utlrp.sql即可解决。 在database configuration assistent最后一步存为script脚本,通过oracle用户运行 成功后显示: SQL> show errors;
A.oracle自带的database configuration assistent
图形化安装模式十分简单,不在赘述,在linux下使用database configuration assistent
容易出错,并不推荐使用。不过dbca有个十分有用的功能,那就是生成建库脚本。
问题一.点击创建数据库后,出现错误:home/oracle/ora9/oracle/bin/dbca: line 124: 31614 Segmentation fault $JRE_DIR/bin/jre -DORACLE_HOME=$OH -DJDBC_PROTOCOL=thin -mx64m -classpath $CLASSPATH oracle.sysman.assistants.dbca.Dbca $ARGUMENTS
图形化界面消失。
修改dbca,将最后一行改为:
# Run DBCA
$JRE_DIR/bin/jre -native -DORACLE_HOME=$OH -DJDBC_PROTOCOL=thin -mx64m -classpath $CLASSPATH oracle.sysman.assistants.dbca.Dbca $ARGUMENTS
fi
即添加了一个native参数即可。
问题二.创建数据库过程中出现ora-29807错误
ORA-29807: specified operator does not exist
This is a known issue (bug 2925665). You can click on the "Ignore" button to continue.
Once DBCA has completed database creation, remember to run the 'prvtxml.plb' script
from $ORACLE_HOME/rdbms/admin independently, as the user SYS. It is also advised
to run the 'utlrp.sql' script to ensure that there are no invalid objects in the database at
this time.
问题三.建库最后弹出用户名密码提示框,输入密码后退出后,画面僵死无反应
这个问题很可能来源于dbca的最后一行设置了native参数,解决方法和问题一恰好相反。这
时即使kill掉dbca,数据库也是无法启动的。至于如何解决启动的问题,见数据库启动问题
一节。
B.使用脚本 create database 语句创建数据库
即可。
主要由以下这些文件组成,linux.sh是主shell:
CreateDBCatalog.sql CreateDB.sql linux.sh
CreateDBFiles.sql init.ora postDBCreation.sql
No errors.
SQL>
SQL> Rem ===========================================================================
SQL> Rem END utlrcmp.sql
SQL> Rem ===========================================================================
SQL> execute utl_recomp.recomp_serial();
PL/SQL procedure successfully completed.
SQL>
SQL> Rem =====================================================================
SQL> Rem Run component validation procedure
SQL> Rem =====================================================================
SQL>
SQL> EXECUTE dbms_registry.validate_components;
PL/SQL procedure successfully completed.
SQL>
SQL> Rem ===========================================================================
SQL> Rem END utlrp.sql
SQL> Rem ===========================================================================
SQL> shutdown ;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> connect SYS/change_on_install as SYSDBA
Connected to an idle instance.
SQL> set echo on
SQL> spool /home/ora/ora9/oracle/assistants/dbca/logs/postDBCreation.log
SQL> create spfile='/home/ora/ora9/oracle/dbs/spfilelinux.ora' FROM pfile='/home/ora/ora9/admin/linux/scripts/init.ora';
File created.
SQL> startup ;
ORACLE instance started.
Total System Global Area 122754448 bytes
Fixed Size 451984 bytes
Variable Size 58720256 bytes
Database Buffers 62914560 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> exit;
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production