eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« 换一种思路 - 通过导出导入进行数据整理 | Blog首页 | 如何调整Oracle Redo Logfile日志文件的大小 »

如何手工创建(Create)一个Oracle 10g数据库

使用惯了dbca,差点忘记了如何手工创建数据库,今天被逼无奈,又用命令行创建了一次数据库。

记录一下过程。
1.首先要有一个参数文件,这个我利用了历史的参数文件
[oracle@dbstatsvr dbstat]$ sqlplus "/ as sysdba"

SQL*Plus: Release 10.2.0.2.0 - Production on Thu Sep 17 18:21:20 2009

Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1778384896 bytes
Fixed Size                  1261332 bytes
Variable Size             301990124 bytes
Database Buffers         1459617792 bytes
Redo Buffers               15515648 bytes

2.创建脚本,参考其他数据库,编写一个
SQL> create database dbstat
  2    logfile   group 1 ('/data1/dbstat/redo1.log') size 50M,
  3              group 2 ('/data1/dbstat/redo2.log') size 50M,
  4              group 3 ('/data1/dbstat/redo3.log') size 50M
  5    character set          ZHS16GBK
  6    national character set utf8
  7    datafile '/data1/dbstat/system.dbf'
  8              size 500M  autoextend on  next 10M maxsize unlimited extent management local
 12    sysaux datafile '/data1/dbstat/sysaux.dbf'
 13              size 500M autoextend on  next 10M  maxsize unlimited
 17    undo tablespace undotbs1
 18              datafile '/data1/dbstat/undo.dbf'  size 100M
 20    default temporary tablespace temp
 21              tempfile '/data1/dbstat/temp.dbf' size 100M;


Database created.
3.在后台跑一跑其他脚本:
[oracle@dbstatsvr dbstat]$ nohup sqlplus "/ as sysdba" @?/rdbms/admin/catalog.sql &
[1] 5399
[oracle@dbstatsvr dbstat]$ nohup: appending output to `nohup.out'

[oracle@dbstatsvr dbstat]$

[1]+  Stopped                 nohup sqlplus "/ as sysdba" @?/rdbms/admin/catalog.sql
[oracle@dbstatsvr dbstat]$
[oracle@dbstatsvr dbstat]$ nohup sqlplus "/ as sysdba" @?/rdbms/admin/catproc.sql &
[2] 5402
[oracle@dbstatsvr dbstat]$ nohup: appending output to `nohup.out'

这样就基本上有了一个数据库的雏形了。

4.还有一个脚本要运行
这是数据库用普通用户登录会出现一个错误,提示以SYSTEM运行PUPBLD.SQL脚本:
SQL> connect sms/sms
Error accessing PRODUCT_USER_PROFILE
Warning:  Product user profile information not loaded!
You may need to run PUPBLD.SQL as SYSTEM
Connected.
这个脚本会创建一个表,用于限制用户执行某些特定的SQL*PLUS命令:
SQL> @?/sqlplus/admin/pupbld.sql
DROP SYNONYM PRODUCT_USER_PROFILE
             *
ERROR at line 1:
ORA-01434: private synonym to be dropped does not exist


  DATE_VALUE FROM PRODUCT_USER_PROFILE
                  *
ERROR at line 3:
ORA-00942: table or view does not exist


DROP TABLE PRODUCT_USER_PROFILE
           *
ERROR at line 1:
ORA-00942: table or view does not exist


ALTER TABLE SQLPLUS_PRODUCT_PROFILE ADD (LONG_VALUE LONG)
*
ERROR at line 1:
ORA-00942: table or view does not exist



Table created.

DROP TABLE PRODUCT_PROFILE
           *
ERROR at line 1:
ORA-00942: table or view does not exist


DROP VIEW PRODUCT_PRIVS
*
ERROR at line 1:
ORA-00942: table or view does not exist



View created.


Grant succeeded.

DROP PUBLIC SYNONYM PRODUCT_PROFILE
                    *
ERROR at line 1:
ORA-01432: public synonym to be dropped does not exist



Synonym created.

DROP SYNONYM PRODUCT_USER_PROFILE
             *
ERROR at line 1:
ORA-01434: private synonym to be dropped does not exist



Synonym created.

DROP PUBLIC SYNONYM PRODUCT_USER_PROFILE
                    *
ERROR at line 1:
ORA-01432: public synonym to be dropped does not exist



Synonym created.

SQL> connect sms/sms
Connected.







历史上的今天...
    >> 2014-09-19文章:
    >> 2013-09-19文章:
    >> 2012-09-19文章:
    >> 2010-09-19文章:
    >> 2007-09-19文章:
    >> 2006-09-19文章:
    >> 2005-09-19文章:
    >> 2004-09-19文章:
           Undo Internal的研究

无觅

By eygle on 2009-09-19 18:29 | Comments (3) | FAQ | HowTo | 2405 |

3 Comments

这个不是OCM考试必考的东西。。。
原来大师平时也用dbca
以前用dbca一直被人鄙视的说

3.在后台跑一跑其他脚本:
是很关键的,不然时间都花在显示输出了。
另外,我在11g下建数据库只要create database sid就可以了,不知道10g是否一样?


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com