手动创建数据库步骤

本文详细介绍了如何在Linux环境下手动创建Oracle数据库,包括安装软件、配置监听、创建追踪和数据文件目录、生成pfile、启动数据库到nomount状态、创建SPFILE、使用SQL语句创建数据库、创建默认表空间、数据字典以及额外的数据库组件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

作者 阿九【转载时请务必以超链接形式标明文章原始出处和作者信息】

 

手动创建数据库步骤

 

1、安装软件

2、升级

3、配置监听

不适用netca来创建和配置,手动创建监听参数文件,在TSN_HOME目录下编辑listener.ora文件,加入如下内容

SID_LIST_LISTENER =

    (SID_LIST =

       (SID_DESC =

         (SID_NAME = PLSExtProc)

         (ORACLE_HOME = /oracle/db10g)

         (PROGRAM = extproc)

       )

    )

LISTENER =

 (DESCRIPTION_LIST=

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.1.21 )(PORT = 1521))

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

    )

 )

4、创建所需的追踪文件存放目录和数据文件存放目录(使用raw的则先配置好raw)

$ORACLE_BASE/admin/orcl/

                     --adump

                     --bdump

                     --cdump

                     --dpdump

                     --pfile

                     --udump

$ORACLE_BASE/oradata/orcl

5、创建所需的pfile文件

*.control_files='/oracle/oradata/orcl/control01.ctl','/oracle/oradata/orcl/control02.ctl','/oracle/oradata/orcl/control03.ctl'

*.audit_file_dest='/oracle/admin/orcl/adump'

*.background_dump_dest='/oracle/admin/orcl/bdump'

*.core_dump_dest='/oracle/admin/orcl/cdump'

*.user_dump_dest='/oracle/admin/orcl/udump'

*.compatible='10.2.0.5.0'

*.db_block_size=8192

*.db_name='orcl'

*.db_domain=''

*.db_file_multiblock_read_count=16

*.job_queue_processes=10

*.open_cursors=300

*.pga_aggregate_target=104857600

*.sga_target=314572800

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.remote_login_passwordfile='EXCLUSIVE'

6、使用pfile启动数据库到nomount状态,创建SPFILE后重启数据库

SQL> create spfile='/oracle/db10g/dbs/spfileorcl.ora' from pfile='/oracle/orcl_pfile.ora';

文件已创建。

SQL>

7、使用SQL语句创建数据库

   CREATE DATABASE orcl

   USER SYS IDENTIFIED BY oracle

   USER SYSTEM IDENTIFIED BY oracle

   LOGFILE GROUP 1 ('/oracle/oradata/orcl/redo01.log') SIZE 100M,

           GROUP 2 ('/oracle/oradata/orcl/redo02.log') SIZE 100M,

           GROUP 3 ('/oracle/oradata/orcl/redo03.log') SIZE 100M

   MAXLOGFILES 16

   MAXLOGMEMBERS 3

   MAXLOGHISTORY 1

   MAXDATAFILES 2048

   MAXINSTANCES 8

   CHARACTER SET ZHS16GBK

   NATIONAL CHARACTER SET AL16UTF16

   DATAFILE '/oracle/oradata/orcl/system01.dbf' SIZE 325M REUSE

   EXTENT MANAGEMENT LOCAL

   SYSAUX DATAFILE '/oracle/oradata/orcl/sysaux01.dbf' SIZE 325M REUSE

   SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/oracle/oradata/orcl/temp01.dbf' SIZE 20M REUSE

   SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/oracle/oradata/orcl/undotbs01.dbf' SIZE 200M REUSE;

8、创建默认表空间,dbca中为USERS,可以创建自定义的,并设置为默认表空间

CREATE SMALLFILE TABLESPACE YJR LOGGING DATAFILE '/oracle/oradata/orcl/yjr01.dbf' SIZE 5M REUSE EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

ALTER DATABASE DEFAULT TABLESPACE YJR;

9、创建数据字典

@$ORACLE_HOME/rdbms/admin/catalog.sql  --创建数据字典表的视图,动态性能视图,和许多的公共同义词。赋予公共访问的同义词。

@$ORACLE_HOME/rdbms/admin/catproc.sql  --运行或使用PL / SQL脚本所需的一切。

10、创建其他的所需的数据库组件

Table B-2 Creating Additional Data Dictionary Structures

Script NameNeeded ForRun ByDescription

catblock.sql

Performance management

SYS

Creates views that can dynamically display lock dependency graphs

catexp7.sql

Exporting data to Oracle7

SYS

Creates the dictionary views needed for the Oracle7 Export utility to export data from the Oracle Database in Oracle7 Export file format

caths.sql

Heterogeneous Services

SYS

Installs packages for administering heterogeneous services

catio.sql

Performance management

SYS

Allows I/O to be traced on a table-by-table basis

catoctk.sql

Security

SYS

Creates the Oracle Cryptographic Toolkit package

catqueue.sql

Advanced Queuing

 

Creates the dictionary objects required for Advanced Queuing

catrep.sql

Oracle Replication

SYS

Runs all SQL scripts for enabling database replication

catrman.sql

Recovery Manager

RMAN or any user with GRANT_RECOVERY_CATALOG_OWNER role

Creates recovery manager tables and views (schema) to establish an external recovery catalog for the backup, restore, and recovery functionality provided by the Recovery Manager (RMAN) utility

dbmsiotc.sql

Storage management

Any user

Analyzes chained rows in index-organized tables

dbmspool.sql

Performance management

SYS or SYSDBA

Enables DBA to lock PL/SQL packages, SQL statements, and triggers into the shared pool

userlock.sql

Concurrency control

SYS or SYSDBA

Provides a facility for user-named locks that can be used in a local or clustered environment to aid in sequencing application actions

utlbstat.sql andutlestat.sql

Performance monitoring

SYS

Respectively start and stop collecting performance tuning statistics

utlchn1.sql

Storage management

Any user

For use with the Oracle Database. Creates tables for storing the output of theANALYZE command with the CHAINED ROWS option. Can handle both physical and logical rowids.

utlconst.sql

Year 2000 compliance

Any user

Provides functions to validate that CHECK constraints on date columns are year 2000 compliant

utldtree.sql

Metadata management

Any user

Creates tables and views that show dependencies between objects

utlexpt1.sql

Constraints

Any user

For use with the Oracle Database. Creates the default table (EXCEPTIONS) for storing exceptions from enabling constraints. Can handle both physical and logical rowids.

utlip.sql

PL/SQL

SYS

Used primarily for upgrade and downgrade operations. It invalidates all existing PL/SQL modules by altering certain dictionary tables so that subsequent recompilations will occur in the format required by the database. It also reloads the packagesSTANDARD and DBMS_STANDARD, which are necessary for any PL/SQL compilations.

utlirp.sql

PL/SQL

SYS

Used to change from 32-bit to 64-bit word size or vice versa. This script recompiles existing PL/SQL modules in the format required by the new database. It first alters some data dictionary tables. Then it reloads the packagesSTANDARD and DBMS_STANDARD, which are necessary for using PL/SQL. Finally, it triggers a recompilation of all PL/SQL modules, such as packages, procedures, and types.

utllockt.sql

Performance monitoring

SYS or SYSDBA

Displays a lock wait-for graph, in tree structure format

utlpwdmg.sql

Security

SYS or SYSDBA

Creates PL/SQL functions for default password complexity verification. Sets the default password profile parameters and enables password management features.

utlrp.sql

PL/SQL

SYS

Recompiles all existing PL/SQL modules that were previously in an INVALID state, such as packages, procedures, and types.

utlsampl.sql

Examples

SYS or any user with DBA role

Creates sample tables, such as emp and dept, and users, such asscott

utlscln.sql

Oracle Replication

Any user

Copies a snapshot schema from another snapshot site

utltkprf.sql

Performance management

SYS

Creates the TKPROFER role to allow the TKPROF profiling utility to be run by non-DBA users

utlvalid.sql

Partitioned tables

Any user

Creates tables required for storing output of ANALYZE TABLE ...VALIDATE STRUCTURE of a partitioned table

utlxplan.sql

Performance management

Any user

Creates the table PLAN_TABLE, which holds output from the EXPLAIN PLAN statement


11、使用SYSTEM表空间的数据库组件

Table 2-2 Database Components and the SYSAUX Tablespace

Component Using SYSAUXTablespace 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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值