手工建库步骤:
1、 Step 1: Decide on Your Instance Identifier (SID)
Linux或unix上:setenv ORACLE_SID mynewdb
Windows上:set ORACLE_SID= mynewdb
2、 Establish the Database Administrator Authentication Method
Linux或unix上:创建合适权限的系统用户和组给database,以及创建database所需的空间、pwdfile等,还有创建新的实例所需要的路径和文件夹目录。一帮情况下是创建dba组和其所属的oracle用户。
Windows上,应该是没必要做的,直接建pwdfile和目录
3、 Create the Initialization Parameter File
不说了,直接根据已有的建一个就OK了,这里再提醒下:官文上说,默认的pfile的目录是在$ORACLE_HOME/dbs/ 底下,因为startup数据库时,会先去$ORACLE_HOME/dbs/底下找spfile,如果找不到,就找pfile
4、 Connect to the Instance
$ SQLPLUS /nolog
CONNECT SYS/password AS SYSDBA
5、 Create a Server Parameter File (Recommended) and Start the Instance
创建spfile文件:
CREATE SPFILE='/u01/oracle/dbs/spfilemynewdb.ora' FROM
PFILE='/u01/oracle/admin/initmynewdb/scripts/init.ora';
SHUTDOWN;
Startup nomount
6、 Issue the CREATE DATABASE Statement
官文上有错,多了一个注释的内容:
CREATE DATABASE mynewdb
USER SYS IDENTIFIED BY pz6r58
USER SYSTEM IDENTIFIED BY y1tz5p
LOGFILE GROUP 1 ('/u01/oracle/oradata/mynewdb/redo01.log') SIZE 100M,
GROUP 2 ('/u01/oracle/oradata/mynewdb/redo02.log') SIZE 100M,
GROUP 3 ('/u01/oracle/oradata/mynewdb/redo03.log') SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET ZHS16GBK
DATAFILE '/u01/oracle/oradata/mynewdb/system01.dbf' SIZE 325M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/oracle/oradata/mynewdb/sysaux01.dbf' SIZE 325M REUSE
--DEFAULT TABLESPACE tbs_1
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u01/oracle/oradata/mynewdb/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/u01/oracle/oradata/mynewdb/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
7、 Create Additional Tablespaces
CREATE TABLESPACE users LOGGING
DATAFILE '/u01/oracle/oradata/mynewdb/users01.dbf'
SIZE 25M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;
CREATE TABLESPACE indx LOGGING
DATAFILE '/u01/oracle/oradata/mynewdb/indx01.dbf'
SIZE 25M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;
8、 Run Scripts to Build Data Dictionary Views
CONNECT SYS/password AS SYSDBA
@/u01/oracle/rdbms/admin/catalog.sql
@/u01/oracle/rdbms/admin/catproc.sql
9、 Run Scripts to Install Additional Options (Optional) and Back Up the Database
经过以上的步骤后,一般能在9i和10g上将数据库的基本功能配置起来,但是要加上其它的功能,比如jvm、oracle text啊什么的,还需要用dbca进行配置,但9i上配置时出错,不知道为什么,改天研究研究。
Considerations After Creating a Database
要注意sys和system帐户的安全,如果在create dadtabse时不指定密码的话,它的密码分别是sysàchange_on_instance、systemàmanager。在建完之后一定要修改之前的密码。
建立本地管理的system表空间(10g),并注意,要跟着建立默认的temporary表空间和undo表空间。
建立本地管理的sysaux表空间(10g),一些原本在各自表空间管理的内容被统一放在了sysaux上管理,如全文检索,原本是放在drsys表空间上,sysaux的存在也会减少system表空间的负担。
创建一个默认的永久表空间(就是上面被我注释掉的那一样,不知为什么,上面那一句老报错)。在建完database后,如果create user时没有指定default tablespace的话,那么用户的default tablespace会是我们create database时建的永久表空间,否则就是system 表空间。
创建一个默认的临时表空间。如果我们没有创建default temporary tablespace的话,oracle是使用system做为临时表空间,这是不建议的。另外,如果system的lmt管理的话,那一定要有一个也是lmt管理的临时表空间,否则应该数据库建不起来吧,具体没试过,哈哈。
可以建立bigfile tablespace。感觉这个挺灵活的,但是system和sysaux是不允许建bigfile的,感觉也没必要,线网上system也只有1G不到的空间。可以为temporary tablespace和undo tablespace建bigfile tablespace,总之是可以共存的,不影响。默认的非bigfile tablespace的表空间(SMALLFILE)可以包含1022个datafiles,而block size可以达到4M。
可以设置force logging。默认情况下,数据库是出于nologging模式的,我们可以通过如下语句修改:ALTER DATABASE /*NO*/ FORCE LOGGING; force logging模式作用:设置成这种模式后,有些数据库操作可以不写日志,比如create index.............nologging;也会写日志。一般用于dataguard以及安全要求较高的数据库,因为dg要保证主库和备库的日志一致,要求所有的事务都可以通过归档进行回滚。
FORCE LOGGING
Use this clause to put the database into FORCE LOGGING mode. Oracle will log all changes in the database except for changes in temporary tablespaces and temporary segments. This setting takes precedence over and is independent of any NOLOGGING or FORCE LOGGING settings you specify for individual tablespaces and any NOLOGGING settings you specify for individual database objects.
FORCE LOGGING mode is persistent across instances of the database. That is, if you shut down and restart the database, the database is still in FORCE LOGGING mode. However, if you re-create the control file, Oracle will take the database out of FORCE LOGGING mode unless you specify FORCE LOGGING in the CREATE CONTROLFILE statement.
1、Some Security Considerations
After the database is created, you can configure it to take advantage of Oracle Identity Management. For information on how to do this, please refer to Oracle Database Enterprise User Security Administrator's Guide.
A newly created database has at least three user accounts that are important for administering your database: SYS, SYSTEM, and SYSMAN.
---------------------------------------------------------------------------------------------------------------------
Caution:
To prevent unauthorized access and protect the integrity of your database, it is important that new passwords for user accounts SYS and SYSTEM be specified when the database is created. This is accomplished by specifying the following CREATE DATABASE clauses when manually creating you database, or by using DBCA to create the database:
USER SYS IDENTIFIED BY
USER SYSTEM IDENTIFIED BY
---------------------------------------------------------------------------------------------------------------------
Additional administrative accounts are provided by Oracle Database that should be used only by authorized users. To protect these accounts from being used by unauthorized users familiar with their Oracle-supplied passwords, these accounts are initially locked with their passwords expired. As the database administrator, you are responsible for the unlocking and resetting of these accounts.
Table 2-6 lists the administrative accounts that are provided by Oracle Database. Not all accounts may be present on your system, depending upon the options that you selected for your database.
Table 2-6 Administrative User Accounts Provided by Oracle Database
Username | Password | Description | See Also |
CTXSYS | CTXSYS | The Oracle Text account | |
DBSNMP | DBSNMP | The account used by the Management Agent component of Oracle Enterprise Manager to monitor and manage the database | Oracle Enterprise Manager Grid Control Installation and Basic Configuration |
LBACSYS | LBACSYS | The Oracle Label Security administrator account | |
MDDATA | MDDATA | The schema used by Oracle Spatial for storing Geocoder and router data | |
MDSYS | MDSYS | The Oracle Spatial and Oracle interMedia Locator administrator account | |
DMSYS | DMSYS | The Oracle Data Mining account. | |
OLAPSYS | MANAGER | The account used to create OLAP metadata structures. It owns the OLAP Catalog (CWMLite). | |
ORDPLUGINS | ORDPLUGINS | The Oracle interMedia user. Plug-ins supplied by Oracle and third party format plug-ins are installed in this schema. | |
ORDSYS | ORDSYS | The Oracle interMedia administrator account | |
OUTLN | OUTLN | The account that supports plan stability. Plan stability enables you to maintain the same execution plans for the same SQL statements. OUTLN acts as a role to centrally manage metadata associated with stored outlines. | |
SI_INFORMTN_SCHEMA | SI_INFORMTN_SCHEMA | The account that stores the information views for the SQL/MM Still Image Standard | |
SYS | CHANGE_ON_INSTALL | The account used to perform. database administration tasks | |
SYSMAN | CHANGE_ON_INSTALL | The account used to perform. Oracle Enterprise Manager database administration tasks. Note that SYS and SYSTEM can also perform. these tasks. | Oracle Enterprise Manager Grid Control Installation and Basic Configuration |
SYSTEM | MANAGER | Another account used to perform. database administration tasks. |
2、Creating the SYSAUX Tablespace
Table 2-2 lists the components that use the SYSAUX tablespace as their default tablespace during installation, and the tablespace in which they were stored in earlier releases:
Table 2-2 Database Components and the SYSAUX Tablespace(sysaux上存储的内容)
Component Using SYSAUX | Tablespace in Earlier Releases |
Analytical Workspace Object Table | SYSTEM |
Enterprise Manager Repository | OEM_REPOSITORY |
LogMiner | SYSTEM |
Logical Standby | SYSTEM |
OLAP API History Tables | CWMLITE |
Oracle Data Mining | ODM |
Oracle Spatial | SYSTEM |
Oracle Streams | SYSTEM |
Oracle Text | DRSYS |
Oracle Ultra Search | DRSYS |
Oracle interMedia ORDPLUGINS Components | SYSTEM |
Oracle interMedia ORDSYS Components | SYSTEM |
Oracle interMedia SI_INFORMTN_SCHEMA Components | SYSTEM |
Server Manageability Components | New in Oracle Database 10g |
Statspack Repository | User-defined |
Oracle Scheduler | New in Oracle Database 10g |
Workspace Manager | SYSTEM |
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14730395/viewspace-680564/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/14730395/viewspace-680564/