Listen Software解决方案 “How To” 系列4:创建数据库

类别:数据库 点击:0 评论:0 推荐:

Listen Software解决方案 “How To” 系列4:创建数据库

计划数据库文件位置

       三组重演日志文件,每组有两个成员文件

       创建数据文件的文件结构


       手工创建数据库

1.设定唯一的实例名和数据库字符集

2.设置操作系统变量

            (UNIX)
                 ORACLE_HOME
                 ORACLE_SID
                 ORACLE_BASE
                 ORA_NLS33
                 PATH

            (NT)
                 ORADIM80 -NEW -SID u16
                 -INTPWD password -STARTMODE auto
                 -PFILE ORACLE_HOME\DATABASE\initu16.ora

                 You must decide the SID, Password, and
                 Create the parameter
                 file (initu16.ora)
                 SET ORACLE_SID=u16
                 SET LOCAL=2:u16
                     

                     语句1:使u16成为当前SID

                     语句2: 覆盖Local环境变量
        

3.     准备参数文件

      使用init.ora作为参数文件模板

      db_name=数据库标识符(最多为8个字符)

      control_files=三个控制文件的位置

      DB_BLOCK_SIZE=数据库块的大小(数据库创建后不能修改)

4.     创建密码文件

5.     启动实例

      STARTUP NOMOUNT pfile=initu16.ora

6.     创建数据库

             从Server Manager上手工创建

                     CREATE DATABASE "U16"
                            MAXLOGFILES 6
                            MAXLOGMEMBERS 6
                            MAXDATAFILES 30
                            MAXLOGHISTORY 100
                            ARCHIVELOG
                     LOGFILE
                            GROUP 1
                                'E:\DATA\U16\GROUP1\log1a.rdo'      SIZE 200K,
                                'E:\DATA\U16\GROUP1\log1b.rdo'      SIZE 200K
                            GROUP 2
                                'E:\DATA\U16\GROUP2\log2a.rdo'      SIZE 200K,
                                'E:\DATA\U16\GROUP2\log2b.rdo'      SIZE 200K
                            GROUP 3
                                'E:\DATA\U16\GROUP3\log3a.rdo'      SIZE 200K,
                                'E:\DATA\U16\GROUP3\log3b.rdo'      SIZE 200K
                             DATAFILE
                            'E:\DATA\U16\DATAFILES\system01.dbf'
                            size 30M
                            CHARACTER SET WE8ISO8859P1;
      
                            查看数据库状态
                            select name,created,log_mode from  v$database;

                            查看线程
                            select status, instance from v$thread;

                            查看数据文件
                            select name from v$datafile;

                            查看日志文件
                            select member from v$logfile;

                            查看控制文件
                            select name from v$controlfile;

                             检验系统创建状态
                            select file_name from dba_data_files
                            where tablespace_name='SYSTEM';

                            查看数据库用户
                            select username, created from dba_users;

7.运行脚本生成数据词典,完成以前创建步骤

                            创建数据词典
                            CATALOG.SQL

                           生成PL/SQL使用的对象
                            CATPROC.SQL
8.维护重演日志文件

                确定归档状态
                select log_mode from v$database;

                 确定自动归档可用
                 select archiver from v$instance;

                 添加新的日志文件组
                 ALTER DATABASE ADD LOGFILE
                (          
                    'c:\data\log3a.rdo',       
                    'e:\data\log3b.rdo'
                ) size 200k;

               查看日志文件信息
                select * from v$log_file;

本文地址:http://com.8s8s.com/it/it21031.htm