Professional Documents
Culture Documents
Oracle Leave A Comment
Oracle Leave A Comment
Oracle Leave A Comment
Posted August 26, 2009 by pradeepkumargs in oracle. Leave a Comment
Q: !
" #
A: The init.ora file is called initialized or parameter file. It is a configuration file.
Q: )(*
## $
A: The Redo Log Buffer holds users¶ entries such as INSERT, UPDATE, DELETE, etc (DML)
and CREATE TABLE, DROP TABLE (DDL). The Redo Entries are information that will be
used to reconstruct, or redo, changes made to a database. The Log Writer writes the entries into
the Online Redo Log files when a COMMIT occurs, every 3 seconds, or when one third of the
Redo Log Buffer is full. That will guarantee a database recovery to a point of failure if an Oracle
database failure occurred.
Q: %
+ "
A: The Multi-threaded Server process will be used when a user send his/her request by using a
shared server. A user¶s request will be assigned to a dispatcher based on the availability of
dispatchers. Then the dispatcher will send or receive request from an assigned shared server.
Q: !
# c #
-
A: The following are the parameters that will be used by a DBA to adjust time or interval of how
frequently its checkpoint should occur on its database.
LOG_CHECKPOINT_TIMEOUT = 3600 # every one hour
LOG_CHECKPOINT_INTERVAL =1000 # number of OS blocks
Q: )
A: The RECO will be used only if you have a distributed database. You use this process to
recover a database if a failure occurs due to physical server problem or communication problem.
Q: (--*
A: The LCKn background process will be used if you have multiple instances accessing to only
one database. An example of that is a Parallel Server or a Real Application Clusters.
Q: !
#*
%
*
A: SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;
Q: #
A: You cannot read this file and it is in a binary format. If you want to see the content of control
file or the layout of your database, you should use the ALTER DATABASE BACKUP
CONTROLFILE TO TRACE statement. It writes a trace file into the
%ORACLE_BASE\admin\\UDUMP directory.
Q: !
%-
% #
A: SQL> ALTER DATABASE BACKUP CONTROLFILE TO c:\ctnlrfl.bk;
Q: !
#
A: To create the password file, you should run the ORAPWD utility from operating system.
For example:
MS-DOS> ORAPWD FILE=%ORACLE_HOME\dbs\orapw.pwd \
PASSWORD=mypass ENTRIES=3
The ENTRIES parameter specifying the number of user entries allowed for the password file.
Now, the DBA can be connected to the database as a user with sysdba privilege.
Q: !
c,12
A: SQL> CONNECT / AS SYSDBA
SQL> STARTUP MOUNT
±OR±
SQL> STARTUP NOMOUNT
SQL> ALTER DATABASE MOUNT;
Q: !
#*
%
A: First you should change the following parameters in the parameter file.
log_archive_dest = /u01/app/oracle/admin//arch
log_archive_start = true
log_archive_format = log%s.arc
Then do the following in the SQLPLUS utility.
SQL> SHUTDOWN IMMEDIATE SQL> STARTUP MOUNT
PFILE=%ORACLE_HOME%\admin\school\pfile\init.ora SQL> ALTER DATABASE
ARCHIVELOG ; SQL> ALTER DATABASE OPEN;
Q: #*(
SQL> ALTER DATABASE RENAME FILE
µC:\ORACLE\ORADATA\SCHOOL\REDO04.LOG¶ TO
µC:\ORACLE\ORADATA\redo04a.log¶ /
A: Assuming that Online Redo Log file is offline, it relocates it to different location.
Q: ## %c +*, +*#
A: A User-Managed file will be defined by an Oracle user. If you drop the tablespace that was
using the file, you should physically delete it from the disk. But an Oracle-Managed file will be
created and defined by Oracle. If you drop the tablespace that was using the file, oracle will
physically deletes the file from the disk. It knows where the file is located.
Q: !
%
*c +*#3
A: You should tell Oracle where it should locate and create datafiles.
SQL> ALTER SYSTEM SET db_create_file_dest=¶c:\newfolder¶; Q: What does the following
SQL statement do?
SQL> CREATE TEMPORARY TABLESPACE mytemp TEMPFILE µmytemp_01.tmp¶ SIZE
20M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 10M /
A: It creates locally managed temporary tablespace with uniform size option.
Q: 2 ) 2,)22(
A: The PCTFREE parameter means that an Oracle user can add records to a block until the
unused space block reaches to the PCTFREE value. When a block uses all space up to the ³1-
PCTFREE´ percentage, it stops adding records to the block. Oracle takes that block out of the
Freelist. It means that records can not be added to the block any more unless you delete records
from the block till it reaches to the PCTUSED value. Then Oracle will add the block in the
Freelist again and records can be added to the block. And this process continues to determine
when to add records in or stop adding records from the block.
Q: !
,1c%
A: SQL> CREATE UNDO TABLESPACE my_undo_tablespace DATAFILE SIZE 100K /
Q: ## %020c1)4+1$(c((4
*%
A: The difference between the DICTIONALY-MANAGED and LOCALLY MANAGED
tablespace is: In the locally managed tablespace all information about the datafiles such as the
last performed checkpoint, etc are stored locally in the datafiles of the tablespace but in the
DICTIONAY-MANAGED tablespace all such information would be stored in the Oracle
repository in the SYSTEM tablespace.
Q: !
2)120c1
%
A: SQL> CREATE GLOBAL TEMPORARY TABLE test_temp (col1 NUMBER(5) PRIMARY
KEY, col2 VARCHAR2 (10) check (col2 BETWEEN µA¶ AND µT¶)) ON COMMIT DELETE
ROWS /
Q: ## %
*
A: A ³Chained Record´ happens when a user updates a record and the new value can not fit in
the existing allocated location. So, Oracle stores the value in a space that allocated for them
(PCTFREE) and add a pointer to the row so that it knows where the rest of the record is. This
process calls row Chaining. Now, if there was no space in the PCTFREE area, then Oracle will
take the whole record and migrate it in a different block that has space. This process calls row
Migration.
Q: !
*#%
A: SQL> ALTER INDEX uk_emp MONITORING USAGE /
Q: 5 20c1012c5 20c1
#
(2)
2(
A: It will insert all exceptions that were found during the ALTER TABLE command into the
EXCEPTIONS table.
Q: !
A: SQL> CREATE USER developer IDENTIFIED BY developer DEFAULT TABLESPACE
iself_data TEMPORARY TABLESPACE temp QUOTA 10K ON iself_data QUOTA 0K ON
SYSTEM PROFILE default PASSWORD EXPIRE ACCOUNT UNLOCK /
Q: !
*#
%
A: SQL> ALTER USER developer
DEFAULT TABLESPACE iself_data
/
Q: !
-
A: SQL> ALTER USER DEVELOPER ACCOUNT LOCK /
Q: c % **
A: The Oracle database triggers are triggers that will occur when an Oracle event happens either
by the DML statements such as UPDATE, DELETE , INSERT, etc; the DDL statements such as
DROP, CREATE, etc; the Database events such as SHUTDOWN, STARTUP, etc; or events in a
schema such as dropping a table in an specific schema.
Q: !
*
A: SQL> ALTER SYSTEM SET audit_trail=db SCOPE=spfile /and you should shutdown and
startup the database.
Q: !
+ *6
.%
A: SQL> EXECUTE dbms_stats.gather_schema_stats (µyour_schema_name¶);