What is stored in database redo log files???
1. changes to data made by the INSERT, UPDATE and DELETE DML statements
2. All DDL statements entered into the database
What causes a checkpoint to occur?
1. Shutting down the database with IMMEDIATE option
2. Taking a tablespace offline with the OFFLINE NORMAL option
3. Switching redo log files
UNDO_SUPPRESS_ERRORS parameter is used to suppress errors while attempting to execute manual operations in auto mode
The UNDO_TABLESPACE parameter specifies the UNDO tablespace to be used. This parameter can be set in the initialization file or altered dynamically using the ALTER SYSTEM command.
The UNDO_MANAGEMENT parameter determines the undo mode of the database and must be set in the initialization file.
REORGANIZE, TRUNCATE, and DROP a table
1. Corresponding indexes are also truncated
2. the table- and row- level triggers are not fired
3. All the rows in the table are deleted, and all of the unused space is released.
ALTER TABLE MOVE command
1. To reorganize a table to eliminate row migration
2. To move a table from one tablespace to another
Which of the following statements about indexes are true?
• Normal index maintenance is performed when the corresponding columns are updated in the underlying table.
• Indexes can be partitioned even if the table is not partitioned.
• Function-based indexes can be created as either B-tree or bitmap indexes.
• Indexes can be created using up to 32 columns, but the combined length of all the columns cannot exceed one third of the space in an index block.
CREATING VARIOUS TYPES OF INDEXES
• Indexes speed up query performance and slow down DML operations.
• If you use the NOLOGGING clause when creating large indexes, then the performance of the database while the index is being created is much better.
When creating an index, you should use a low PCT FREE value for indexes on columns that are monotonically increasing, such as system-generated invoice numbers
ALTER TABLE orders MODIFY CONSTRAINT order_pk PRIMARY KEY (order_id) DEFERERRABLE ENABLE NOVALIDATE command
ENABLE—causes new data to be checked
NOVALIDATE—- skips the checking of existing data
DEFERRABLE—- forces the use of a nonunique index
Profiles can be disabled and enabled, they are assigned to users with the CREATE or ALTER USER commands, and they can inherit values only from the DEFAULT profile.
DBMS_OUTPUT package is an Oracle-supplied PL/SQL object used to aid in the debugging of user-developed PL/SQL code objects.
It cannot be used to change the language-dependent behavior settings of be database.
Obtain control file information:
1. V$CONTROLFILE: Lists the name and status of all control files associated with the instance
SELECT name FROM V$CONTROLFILE;
2. V$PARAMETER: Lists status and location of all parameters
SELECT name, value FROM V$PARAMETER
WHERE name= ‘control_files’;
3. V$CONTROLFILE_RECORD_SECTION: Provides information abt the control file record sections
SELECT type, record_size, records_total, records_used
FROM v$controlfile_record_section
WHERE type=’controlfile’;
3. SHOW PARAMETER control_files: Lists the name, status and location of the control files.
Describe the logical structure of the database
Locally managed tablespaces have which of the following advantages over dictionary-managed tablespaces??
1. Recursive space management operations are avoided.
2. Adjacent free space is automatically tracked, so you do not need to coalesce free extents.
3. Contention on data dictionary tables is reduced, because locally managed tablespaces do not record free space there.
A tablespace can belong to only one database at a time and can consist of one or more data files.
Change the status of tablespaces
To make a tablespace read only
1. The tablespace must not be of the temporary type.
2. The tablespace must not be in ACTIVE backup status
3. The tablespace must not contain any active rollback segments.
Difference between read only and offline tablespaces is that the segments of a read only tablespace are available for read operations and can be dropped from the database.
Change the storage settings of tablespaces
To resize a tablespace
1. Use the ALTER DATABASE cmd to change the size of the datafiles used by a tablespace.
2. Use the ALTER DATABASE cmd to turn the autoextend feature on for each of the datafiles within a tablespace.
Situation LGWR performs sequential writes from the redo log buffer
1. When redo log buffer is one-third full.
2. When a transaction is committed.
3. Before DBWn writes modified blocks in the database buffer cache to the datafiles
Monitoring the Use of Diagnostic Files
The ALTER SESSION SET SQL_TRACE = TRUE command causes the server to write a trace file for the session that issued the statement. The trace file is written to the directory specified by the USER_DUMP_DEST parameter.
To let all DML operation finish and then shut down the database, you use the SHUTDOWN TRANSACTIONAL command.
The correct answer is alert log: this is where the database’s day-to-day activities are tracked
The BACKGROUND_DUMP_DEST parameter controls where the alert log and background trace file are written.
Prerequisites Necessary for Database Creation
ORAPWD this is the utility you use to create a password file for an Oracle database
SYSDBA privileges are required to create a database. These are granted either using operating system authentication or password file authentication.
Create a Database Using Oracle Database Configuration Assistant
Benefits of using templates
1. Templates allow database options to be changed at database creation
2. Templates can be shared
3. Templates save time when you create a database
The ORACLE_SID operating system environment variable uniquely identifies the Oracle instance on the server.
The Database Configuration Assistant is Oracle’s GUI tool for creating a database.
Create a Database Manually
The TIME_ZONE argument of the CREATE DATABASE statement sets the time zone for the database
MAXLOGFILES the maximum number of log file groups can be changed only by re-creating the control file.
DEFAULT TEMPORARY TABLESPACE: this argument of the CREATE DATABASE statement creates a default tablespace for sort operations for users that are not assigned a temporary tablespace.
Explain the Uses of Control File
The control file is opened and read when the database enters the Mount state, and the control file remains open until the database is dismounted.
Allocate Space for Temporary Segments
Tempfiles:
1. Tempfiles are always set to the NOLOGGING mode
2. You cannot make a tempfile read only.
3. You cannot rename a tempfile
4. You cannot create a tempfile with the ALTER DATABASE command.
List the Keywords That Control Block Space Usage
Segments created in a tablespace with automatic space management
1. The tablespace must have locally managed extents.
2. The PCTUSED and FREELISTS parameters are ignored.
Obtain Information about Storage Structures from the Data Dictionary
All the space in a data file (excluding the header block) must be accounted for in either the DBA_FREE_SPACE or DBA_EXTENTS view.
The DBA_FREE_SPACE table shows the amount of free space available in each tablespace
Implement Automatic Undo Management
Multiple undo tablespaces can exist, but only one at a time can be active per instance. Undo tablespaces can be dropped: they are not required for Oracle9i, because you can still use rollback segments. The system can switch to another undo tablespace only when a DBA issues the proper command.
1. UNDO_MANAGEMENT parameter determines the undo mode of the database and must be set in the initialization parameter file;
2. UNDO_TABLESPACE parameter specifies the UNDO tablespace to be used, and it can be set in the initialization files or altered dynamically using the ALTER SYSTEM command;
3. UNDO_SUPPRESS_ERRORS parameter is used to suppress errors while attempting to execute manual operations in Auto mode.
Implement Data Integrity Constraints
1. Constraints enforce rules even when application code is bypassed with ad hoc tools.
2. Constraints are stored in a central repository.
3. Constraints are faster than application code
Three primary ways in which data integrity can be maintained within a database
Application code, database triggers, and declarative integrity constraints
Manage Passwords Using Profiles
Which views do you select from to see the password limit settings currently enforced for a particular user?
DBA_USERS and DBA_PROFILES
The RESOURCE_LIMIT parameter can be used to enable and disabled kernel limits in profiles; password limits are always enforced.
Administer Profiles
Each profile can be assigned to one or more users. However, each user must be assigned one and only one profile. The DEFAULT profile is assigned to all users initially until another profile is explicitly assigned.
Profiles can be disabled and enabled, they are assigned to users with the CREATE or ALTER USER commands, and they can inherit values only from the DEFAULT profile
Control Use of Resources Using Profiles
Profiles allow database administrators to prevent users from “hogging” resources, by configuring the system so that the user’s session is killed when SESSION_IDLE_TIME is exceeded.
When any session resource limit is exceeded, the user receives an error message and is disconnected.
Create New Database Users
No quota should be assigned to the TEMP tablespace. The database kernel internally manages quotas on the designated temporary tablespace that is assigned to a user.
A user created with the IDENTIFIED EXTERNALLY clause can use the same username for both operating system and database access.
Alter and Drop Existing Database Users
If a user is altered to have 0 quota on a particular tablespace, then that user loses access to all of the objects he or she owns which are stored in that tablespace [FALSE]
Such users maintains access to any remaining free space in any objects they own that are currently stored in that tablespace. They cannot create or extend any new objects which require storage space in that tablespace.
The CASCADE clause is used with the DROP USER command in order to remove any database objects currently owned by the user being dropped.
Grant and Revoke Privileges
You must have the References object privilege on any table in another schema to which you want to create a foreign key.
Unlike a system privilege, which remains in force for users who were granted the privilege by a subsequent grantor, object privileges are revoked in a cascade, and therefore removed from subsequent grantees.
Create and Modify Roles
Which of the following statements about roles are true?
1. User privileges obtained through a role are set at login or with the SET ROLE command
2. A role can be assigned to another role.
A role can be granted to a user or another role. Grouping application roles into job function roles is an common way to use roles to support a large number of users.
Control Availability of Roles
An application role is created with the USING keyword and a PL/SQL object to be used for the role authentication.
The GRANT command is used to assign a role to a user. The ALTER ROLE command is used to maintain the contents of a role.