oracle 8 database administration volume 1 instruction guide phần 4 ppsx

40 331 0
oracle 8 database administration volume 1 instruction guide phần 4 ppsx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Trace Files and the ALERT File Controlling the Trace File Instance SGA Shared pool User process Server process ALERT file USER_DUMP_DEST 3-24 BACKGROUND_DUMP_DEST Copyright © Oracle Corporation, 1998 All rights reserved The following parameters control the location and size of the trace files: BACKGROUND_DUMP_DEST defines the location of the background trace file and ALERT file USER_DUMP_DEST defines where trace files will be created at the request of the users MAX_DUMP_FILE_SIZE specified in O/S blocks, limits the size of user trace files Note • The MAX_DUMP_FILE_SIZE and USER_DUMP_DEST parameters are dynamic initialization parameters • On UNIX, the alert file is named alert_.log and is located in the $ORACLE_HOME/rdbms/log directory by default • On Windows NT, the alert file is named alrt.log and is located in the %ORACLE_HOME%\RDBMS80\TRACE directory by default Oracle8: Database Administration 3-41 Lesson 3: Managing an Oracle Instance Guidelines Check the ALERT file periodically to: • Detect internal errors (ORA-600) and block corruption errors • Monitor database operations • View the nondefault initialization parameter 3-25 Copyright © Oracle Corporation, 1998 All rights reserved It is important for the database administrator to check the ALERT file regularly to detect problems before they become serious The following information is logged in the ALERT file: • All internal errors (ORA-00600) and block corruption errors (ORA-01578) • Operations that affect database structures and parameters, and Server Manager statements such as STARTUP, SHUTDOWN, ARCHIVE LOG, and RECOVER • The values of all nondefault initialization parameters at the time the instance starts Instructor Note You may query the current setting for BACKGROUND_DUMP_DEST, change to that directory, and show the alert and trace files in the directory 3-42 Oracle8: Database Administration Summary Summary Summary • Starting up and shutting down an instance • Understanding the use of dynamic performance views • Describing the use of trace files 3-26 Copyright © Oracle Corporation, 1998 All rights reserved Oracle8: Database Administration 3-43 Lesson 3: Managing an Oracle Instance Quick Reference Context Initialization parameters Reference DB_NAME CONTROL_FILES SHARED_POOL_SIZE BACKGROUND_DUMP_DEST DB_BLOCK_BUFFERS COMPATIBLE IFILE LOG_BUFFER PROCESSES Dynamic initialization parameters Dynamic initialization parameters (deferred) Dynamic performance views SQL_TRACE USER_DUMP_DEST MAX_DUMP_FILE_SIZE TIMED_STATISTICS SORT_AREA_SIZE V$FIXED_TABLE V$PARAMETER V$CONTROLFILE V$DATABASE V$DATAFILE V$DATAFILE_HEADER V$INSTANCE V$LOGFILE V$OPTION V$PROCESS V$PWFILE_USERS V$SESSION V$SGA V$VERSION 3-44 Oracle8: Database Administration Summary Data dictionary views Commands None CONNECT / AS SYSDBA CONNECT / AS SYSOPER STARTUP SHUTDOWN SHOW PARAMETER ALTER SYSTEM KILL SESSION ALTER SYSTEM DISCONNECT SESSION POST_TRANSACTION ALTER SYSTEM ENABLE RESTRICTED SESSION ALTER SYSTEM DISABLE RESTRICTED SESSION ALTER SESSION SET ALTER SYSTEM SET ALTER SYSTEM SET DEFERRED ALTER DATABASE MOUNT Packaged procedure and functions ALTER DATABASE OPEN None Oracle8: Database Administration 3-45 Lesson 3: Managing an Oracle Instance 3-46 Oracle8: Database Administration Creating a Database Lesson 4: Creating a Database Instructor Note Topic Lecture Timing 60 minutes Practice 60 minutes Total 120 minutes 4-2 Oracle8: Database Administration Objectives Objectives Objectives • Preparing the operating system • Preparing the parameter file ã Creating the database 4-2 Copyright â Oracle Corporation, 1998 All rights reserved Oracle8: Database Administration 4-3 Lesson 4: Creating a Database Overview Overview Instance SGA User process Shared Pool Server process PGA Control files Parameter file Redo log files Datafiles Password file 4-3 Database Copyright © Oracle Corporation, 1998 All rights reserved Creating the database is the first step in managing and organizing a database system Database creation is a task that prepares several operating system files and is needed only once no matter how many data files the database has This is a very important task because the database administrator must decide on database settings, such as the size of the database block and the database character set, which cannot be changed after the creation Depending on the operating system, a database may have been created automatically as part of the installation You can use this initial database, or you can erase it and create a new one manually During migration from an older version of Oracle, database creation is necessary only if an entirely new database is needed Otherwise you can use a migration utility—for example, MIG80 on NT—to migrate from an earlier version of the database You can create a database with new data files or by erasing information in an existing database that has the same physical structure The CREATE DATABASE command initiates the creation of the control files, redo log files, and the data dictionary structure that Oracle server requires to access the database 4-4 Oracle8: Database Administration Lesson 4: Creating a Database Starting the Instance Connect as SYSDBA Start the instance in NOMOUNT stage SVRMGR> STARTUP NOMOUNT \ 2> PFILE=initU16.ora ORACLE instance started 4-14 Copyright © Oracle Corporation, 1998 All rights reserved Connect as SYSDBA using operating system authentication or the password file method and start the instance using the STARTUP command The password is the one that was previously used to create the service with the ORDIM80 utility on NT or that was previously created by using the orapwd utility on UNIX If the parameter file is not in the default location, you may need to specify the PFILE clause in the STARTUP command For this course, the parameter file is located in the current directory 4-20 Oracle8: Database Administration Creating a Database Creating the Database SPOOL creU16.log STARTUP NOMOUNT PFILE=initU16.ora CREATE DATABASE U16 MAXLOGFILES MAXLOGMEMBERS MAXDATAFILES 100 MAXLOGHISTORY 100 LOGFILE GROUP ('/DISK3/log1a.rdo',/DISK4/log1b.rdo’) SIZE M, GROUP ('/DISK3/log2a.rdo',/DISK4/log2b.rdo’) SIZE M DATAFILE '/DISK1/system01.dbf' size 50M autoextend on CHARACTER SET WE8ISO8859P1; 4-15 Copyright © Oracle Corporation, 1998 All rights reserved To create a database, use the following SQL command: CREATE DATABASE [database] [CONTROLFILE REUSE] [LOGFILE [GROUP integer] filespec [, [GROUP integer] filespec] ] [MAXLOGFILES integer] [MAXLOGMEMBERS integer] [MAXLOGHISTORY integer] [MAXDATAFILES integer] [MAXINSTANCES integer] [ARCHIVELOG|NOARCHIVELOG] [CHARACTER SET charset] [NATIONAL CHARACTER SET charset] [DATAFILE filespec [autoextend_clause] [, filespec [autoextend_clause] ]] filespec :== 'filename' [SIZE integer][K|M] [REUSE] Oracle8: Database Administration 4-21 Lesson 4: Creating a Database autoextend_clause :== [AUTOEXTEND {OFF |ON [NEXT integer[K|M]] [MAXSIZE {UNLIMITED|integer[K|M]}] } ] where: database is the name of the database to be created (If the name of the database is omitted, the initialization parameter DB_NAME is used.) CONTROLFILE REUSE specifies that an existing control file identified in the parameter file should be reused LOGFILE GROUP specifies the names of the log files to be used and the group to which they belong MAXLOGFILES is the maximum number of log file groups that can be created for the database MAXLOGMEMBERS is the maximum number of log file members for a log file group MAXLOGHISTORY is the maximum number of archived redo logs for automatic media recovery of the Oracle Parallel Server DATAFILE filespec specifies the data files to be used AUTOEXTEND enables or disables the automatic extension of a data file (see “Maintaining Tablespaces and Data Files”) MAXDATAFILES is the maximum number of data files that can be created for the database MAXINSTANCES is the maximum number of instances that can simultaneously mount and open the database ARCHIVELOG establishes that redo logs must be archived before they can be reused NOARCHIVELOG establishes that redo logs can be reused without archiving their contents 4-22 Oracle8: Database Administration Creating a Database CHARACTER SET is the character set the database uses to store data NATIONAL CHARACTER SET specifies the national character set used to store data in columns defined as NCHAR, NCLOB, or NVARCHAR2 If not specified, the national character set is the same as the database character set (see the lesson “Using National Language Support”) If REUSE is specified in a file specification, then the file must exist; otherwise the SIZE option must be specified and the file must not exist Example Turn on spooling to save messages and run the CREATE statement The creation results in a database with the name U16 The database consists of two online redo log file groups, each with two 1M members and one 50M data file The database stores data with an 8-bit character set Note • Oracle server allocates as much space in the control files as the values of MAXLOGMEMBERS, MAXLOGFILES, MAXDATAFILES, MAXLOGHISTORY, and MAXINSTANCES require To change the value of these parameters, use the CREATE CONTROLFILE command to re-create the control file (See the course Oracle8: Backup and Recovery Workshop) • There is no DROP DATABASE command To delete a database, you must delete the data files from the operating system With the Oracle Database Assistant it is possible to remove the services as well as the data files • To make the new database the default database on NT, change the ORACLE_SID in the registry • It is not possible to change the character set or the national character set after creating the database • On NT you can use the build_db.sql script located in the %ORACLE_HOME%\RDBMS80\ADMIN directory to create a database Oracle8: Database Administration 4-23 Lesson 4: Creating a Database Oracle Database Assistant 4-16 Copyright © Oracle Corporation, 1998 All rights reserved To start the Oracle Database Assistant after the installation, follow these steps: Choose Start—>Programs—>Oracle Windows NT—>Oracle Database Assistant This utility is the simplest method to create an Oracle database Proceed to the last Oracle Database Assistant screen and complete the creation The Oracle Database Assistant starts the related services, edits the init.ora files and creates a database or deletes the database and services You can either create the database or store the steps of the creation in the following batch scripts: Contents of sqlu16.bat: set ORACLE_SID=U16 C:\ORANT\bin\oradim80 -new -sid U16 -intpwd oracle -startmode auto -pfile C:\ORANT\database\initU16.ora C:\ORANT\bin\oradim80 -startup -sid U16 -starttype srvc,inst -usrpwd oracle -pfile C:\ORANT\database\initU16.ora C:\ORANT\bin\svrmgr30 @U16run.sql 4-24 Oracle8: Database Administration Creating a Database where: the u16run.sql script contains: spool C:\ORANT\database\spoolmain set echo on connect INTERNAL/oracle startup nomount pfile=C:\ORANT\database\initU16.ora CREATE DATABASE U16 LOGFILE 'C:\ORANT\database\logU161.ora' SIZE 1024K, 'C:\ORANT\database\logU162.ora' SIZE 1024K MAXLOGFILES MAXLOGMEMBERS MAXLOGHISTORY DATAFILE 'C:\ORANT\database\Sys1U16.ora' SIZE 50M MAXDATAFILES 100 MAXINSTANCES CHARACTER SET WE8ISO8859P1 NATIONAL CHARACTER SET WE8ISO8859P1; spool off Oracle8: Database Administration 4-25 Lesson 4: Creating a Database And the initU16.ora contains: db_name = U16 db_files = 1020 control_files = ("C:\ORANT\database\ctl1U16.ora", "C:\ORANT\database\ctl2U16.ora") db_file_multiblock_read_count = 16 db_block_buffers = 2000 shared_pool_size = 30000000 log_checkpoint_interval = 8000 processes = 100 dml_locks = 200 log_buffer = 65536 sequence_cache_entries = 30 sequence_cache_hash_buckets = 23 #audit_trail = true #timed_statistics = true background_dump_dest = C:\ORANT\rdbms80\trace user_dump_dest = C:\ORANT\rdbms80\trace db_block_size =8192 compatible = 8.0.4.0.0 sort_area_size = 65536 log_checkpoint_timeout = remote_login_passwordfile = shared max_dump_file_size = 10240 4-26 Oracle8: Database Administration Creating a Database Troubleshooting Creation of the database fails if: • There are syntax errors in the SQL script • Files that should be created already exist • Operating system errors such as file or directory permission or insufficient space errors occur 4-17 Copyright © Oracle Corporation, 1998 All rights reserved If one of these three errors occurs, the CREATE DATABASE statement fails In every case, you should shut down the database, delete any files created by the CREATE DATABASE statement, correct the errors, and attempt to create again Oracle8: Database Administration 4-27 Lesson 4: Creating a Database After Creation of the Database The database contains: • Data files which make up the SYSTEM tablespace • Control files and redo log files • User SYS/change_on_install • User SYSTEM/manager • Rollback segment SYSTEM • Internal tables (but no data dictionary views) 4-18 Copyright © Oracle Corporation, 1998 All rights reserved After creation of the database, the database is open, the SQL script sql.bsq is successfully executed, and the database objects named in this slide are created You can view the dynamic performance views such as V$LOGFILE, V$CONTROLFILE and V$DATAFILE, but no data dictionary views are created The following lessons explain how to create the data dictionary views, to create additional tablespaces, alter and add redo log files, add control files, and so on 4-28 Oracle8: Database Administration Creating a Database Summary • Planning the database structure • Preparing the operating system environment • Creating the database 4-19 Copyright © Oracle Corporation, 1998 All rights reserved Quick Reference Context Initialization parameters Reference DB_NAME CONTROL_FILES Dynamic performance views Data dictionary views Commands Packaged procedures and functions DB_BLOCK_SIZE None None CREATE DATABASE None Oracle8: Database Administration 4-29 Lesson 4: Creating a Database 4-30 Oracle8: Database Administration Creating Data Dictionary Views and Standard Packages Lesson 5: Creating Data Dictionary Views and Standard Packages Instructor Note Topic Lecture Timing 40 minutes Practice 40 minutes Total 80 minutes 5-2 Oracle8: Database Administration Objectives Objectives Objectives • Constructing the data dictionary views • Using the data dictionary • Preparing the PL/SQL environment using the administrative scripts ã Administering stored procedures and packages 5-2 Copyright â Oracle Corporation, 1998 All rights reserved Oracle8: Database Administration 5-3 Lesson 5: Creating Data Dictionary Views and Standard Packages Data Dictionary Structure Using the Data Dictionary The data dictionary provides information about: • Logical and physical database structure • Names, definitions, and space allocation of schema objects • Integrity constraints • Database users and privileges ã Auditing 5-3 Copyright â Oracle Corporation, 1998 All rights reserved The data dictionary is an important part of an Oracle database The data dictionary is a set of tables and views that are used as a reference to provide information about the associated database The base data dictionary tables are created by the script file sql.bsq during the creation of the database The data dictionary is a central source of information for the Oracle server and for database administrators and database users The data dictionary is updated by the Oracle server whenever a DDL command is executed In addition DML commands such as those that result in a table to expand can update the data dictionary Instructor Note You may want to ask the students what are the DDL commands In the current context DDL commands enable the following functions: • Creating, dropping and altering objects • Granting and revoking privileges and roles • Analyze information on a table, index, and cluster (see the lesson “Managing Tables”) • Establishing auditing options (see the lesson “Auditing”) • Adding comments to the data dictionary 5-4 Oracle8: Database Administration ... log_buffer = 327 68 # MEDIUM # log_buffer = 16 3 84 0 # LARGE 4 -13 Copyright © Oracle Corporation, 19 98 All rights reserved 4- 18 Oracle8 : Database Administration Creating a Database ... © Oracle Corporation, 19 98 All rights reserved 4- 6 Oracle Database Files /u03/ /u02/ oradata/ db 01/ system 01. dbf control 01. ctl redo 010 1.rdo db02/ system 01. dbf control 01. ctl redo 010 1.rdo 4- 7... db 01/ tools 01. dbf control02.ctl redo 010 2.rdo db02/ users 01. dbf control02.ctl redo 010 2.rdo Copyright © Oracle Corporation, 19 98 All rights reserved 4 -8 Oracle8 : Database Administration

Ngày đăng: 08/08/2014, 20:21

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan