Presentation is loading. Please wait.

Presentation is loading. Please wait.

Week 2 Lecture 2 Data Dictionary Views and Control Files.

Similar presentations


Presentation on theme: "Week 2 Lecture 2 Data Dictionary Views and Control Files."— Presentation transcript:

1 Week 2 Lecture 2 Data Dictionary Views and Control Files

2 Learning Objectives  Use the data dictionary components and views  List useful dynamic performance views  Manage and multiplex control files

3 Learning Objectives con’t.  Use OMF to manage control files  Create new control files  View control file data

4 Looking at Important Data Dictionary Components Data dictionary views: Use underlying tables owned by SYS Can be queried like other views Number in the hundreds

5 Looking at Important Data Dictionary Components The DICTIONARY view lists data dictionary views with a short description

6 Data dictionary views: Cannot be updated Are documented on otn.oracle.com Have a prefix that defines the scope: USER: Views focused on a user’s own objects ALL: Views about objects a user either owns or can query DBA: Views for DBAs only, showing information about all objects in the database Looking at Important Data Dictionary Components

7 Using Data Dictionary Views Uses for Data Dictionary Views Supply information to the Enterprise Manager console Help you build queries Help you review naming standards Help you find invalid views Much more…

8 Useful Dynamic Performance Views Dynamic performance views are similar to data dictionary views except: The contents of the views change with database activity They are used mostly for tuning and monitoring Dynamic performance views are prefixed with: V$: Standard dynamic performance view GV$: View spanning multiple instances

9 Useful Dynamic Performance Views Some useful views include: V$SYSSTAT: statistical details about all sessions running on the database V$SQL: Details on individual SQL statements running on the database V$SESSTAT: Information by session to help identify memory usage

10 Introduction to the Control File The control file contains current details about the database: Database name Data file and online redo log file names and locations Checkpoint information critical to recovery

11 Managing and Multiplexing the Control Files What you can do with control files: Add a new control file Rename or relocate an existing control file Delete an existing control file (so long as at least one remains) Replace a damaged control file Regenerate a control file

12 Adding a New Control File Steps in a nutshell: 1. Shut down the database 2. Copy a current control file 3. Edit the init.ora file 4. Start up the database

13 Renaming or Relocating an Existing Control File Steps in a nutshell: 1. Shut down the database 2. Rename or relocate a current control file 3. Edit the init.ora file 4. Start up the database

14 Replacing a Damaged Control File Steps in a nutshell: 1. Shut down the database 2. Delete the bad control file 3. Copy a good control file, naming the copy to match the old, bad control file 4. Start up the database

15 Using OMF to Manage Control Files OMF can create and manage control files Requires the use of initialization parameters when creating the database: CONTROL_FILES is blank DB_CREATE_ONLINE_LOG_DEST_n has valid directory name DB_CREATE_FILE_DEST can be used instead if no multiplexing is needed

16 Using OMF to Manage Control Files Example: Initialization parameters: CONTROL_FILES = ‘’ DB_CREATE_ONLINE_LOG_DEST_1=‘ C:\ora\oradata’ DB_CREATE_ONLINE_LOG_DEST_2=‘D:\ora\oradata’ CREATE DATABASE command: CREATE DATABASE TECHNO92 MAXDATAFILES 100 DATAFILE ‘C:\ora\oradata\system01.dbf' SIZE 325M AUTOEXTEND; Creates a database with OMF control files and OMF redo log files and user-managed data files

17 Creating a New Control File Needed when: All control files are lost or damaged Changing initialization parameters that affect the size of the control file Changing the database name How to create a new control file: Use manually created command Use generated script

18 Creating a New Control File The manually created command syntax: CREATE CONTROLFILE REUSE SET DATABASE LOGFILE GROUP n 'X/xxx/logfilename' SIZE, GROUP 2 'X/xxx/logfilename' SIZE NORESETLOGS DATAFILE ' / ',.... MAXLOGFILES MAXLOGMEMBERS MAXLOGHISTORY MAXDATAFILES MAXINSTANCES ARCHIVELOG CHARSET ; List all datafiles List all redo log groups and members

19 Creating a New Control File The generated script command: ALTER DATABASE BACKUP CONTROL FILES TO TRACE; You must be logged on as a DBA user such as SYSTEM You must use this command before the control files are lost or damaged, while the database is open

20 Creating a New Control File Example of a generated script

21 Viewing Control File Data The control file has record sections for: File identification Details needed for recovery Database activity and status Recovery checkpoints

22 Viewing Control File Data Use dynamic performance views to see control file information

23 Lecture Summary Data dictionary views and dynamic performance views are owned by SYS Use normal queries on these views Most data dictionary views have a prefix of USER, ALL, or DBA Most dynamic performance views have a prefix of V$ or GV$

24 Lecture Summary Control files track current information on: Datafiles and online redo log files Checkpoints and log group number By creating more than one control file, you multiplex the control files Add extra control files by copying others

25 Lecture Summary You can also rename or relocate existing control files You can replace damaged control files with copies of undamaged ones You can recreate a control file either manually or using a generated script

26 Lecture Summary The manual method requires building a CREATE CONTROLFILE command The generated method creates the CREATE CONTROLFILE command for you Several V$ views show information stored in the control file


Download ppt "Week 2 Lecture 2 Data Dictionary Views and Control Files."

Similar presentations


Ads by Google