DBA Solved All

August 10, 2022 | Author: Anonymous | Category: N/A
Share Embed Donate


Short Description

Download DBA Solved All...

Description

 

Q1: In an organization, the tablespace contains the important Salary table and Redo log files is drop at 11 o cock. How we can recover our Database? Write all steps, commands (20145,) 1) Shutdown the database and begin recovery. Because the failure time is known and database structure is not change since 11 o clock. So we can use until time method for recovery: If the database is open, shut it down by using either normal, immediate or transactional option. 2) Restore all data files from backup. You may need to store archived logs. If there is enough space available, restore r estore the LOG_ARCHIVE_DEST location or use the ARCHIVE SYSTEM ARCHIVE LOG START TO or SET LOGSOURCE to change the location. 3) Mount the database. 4) Recover the database. SQL> recover database until time 2001-3-09 11 o clock. 5) To synchronize data files with control files fil es and redo logs, open the database using RESETLOGS option. SQL> alter database open resetlogs; SQL> archive log list; 6) Before performing the whole closed database backup, query salary table to make it it sure that it exists. When recovery is successful and backup has completed, notify the users that database is available for use, and any data entered after the recovery time 11 o clock will need to be reentered. Q2: Write steps and commands to take open database backup of database running in Archived log mode? (20145, 20175) To make an efficient backup Steps: 1.  Define the location of the snapshot control file. 2.  Configure the auto backup control file. 3.  Configure the archived redo logs. 4.  Configure the flash recovery area. Backup Commands 1.  Login to the server executing the database. 2.  Start the RMAN executable at the operating system using the rman command. 3.  At the RMAN prompt, connect to the target database using the CONNECT TARGET command.

 

RMAN> CONNECT TARGET; 4.  At the RMAN prompt, backup the database to the Flash Recovery Area using the command: RMAN> Backup Database Plus Archivelog; 5.  To check the list of backups, use following command: RMAN> List Backup; Q3: Write the recovery steps with commands. When database is running in Archiving mode and database is initially closed? (20145, 20175) 1.  Log in to the database and a nd connect as sys DBA 2.  At the SQL command line prompt enter the following command. “SHUTDOWN IMMEDIATE” If the above command is successful, then displays the following output: Database Closed Databased Dismounted ORACLE INSTANCE SHUTDOWN 3.  At the SQL command line prompt, enter the following command “STARTUP MOUNT” If the above command is successful, then it displays the following output ORACLE instance started TOTAL SYSTEM GLOBAL AREA 599785472 bytes FIXED SIZE 1220804 bytes VARIABLE SIZE 180358972 bytes DATABASE BUFFERE 415236096 bytes REDO BUFFERE 2969600 bytes Database Mounted Q4: Write a command to create a user Ali having 1GB Quota on each tablespace TBS1 and TBS2 and TBS1 is default tablespace for Ali. (20145, 20165) As 1GB = 1000MB SQL> CREATE USER ALI IDENTIFIED BY 1234; SQL> QUOTA 1000M ON TBS1; SQL> QUOTA 1000M ON TBS2; SQL> DEFAULT TABLESPACE TBS1; Ali. ” Note: in 2016 there is not asked to do “and TBS1 is default tablespace for Ali.”

 

 

Q1: Explain the working of the query in shared server configuration with diagram? (2014 5, 20165)

How a Request is Processed 4.  A user sends a request to its dispatcher. 5.  The dispatcher places the request into the request queue in the System Global Area (SGA). 6.  A shared server picks up the request from the request queue and processes the request. 7.  The shared server places the response on the calling dispatcher's response queue. 8.  The response is handed off to the dispatcher. 9.  The dispatcher returns the response to the user. Once the user call has been completed, the shared server process is released and is available to service another user call in the request queue. Request Queue One request queue is shared by all dispatchers. Shared servers monitor the request queue for new requests.

 

Requests are processed on a first-in, first-out (FIFO) basis. servers place all a ll completed requests on the calling di Each dispatcher has its own response queue in the SGA. 's response queue. Each dispatcher is responsible for sending completed requests back to the appropriate user process. Users are connected to the same dispatcher for the duration of a session. Q2: Multiplex a control file while using SP file? (2014 5, 20155) SQL> show SQL>  show parameter spfile NAME TYPE VALUE ------------------------------------ ----------- -----------------------------spfile string C:\ORACLEXE\APP\ORACLE\PRODUCT \11.2.0\SERVER\DBS\SPFILEXE.ORA SQL> select SQL>  select name from v$controlfile; NAME -------------------------------------------------------------------------------C:\ORACLEXE\APP\ORACLE\ORADATA\XE\CONTROL.DBF SQL>  ALTER SYSTEM SET CONTROL_FILES = SQL> ‘C:\ORACLEXE\APP\ORACLE\ORAD C:\ORACLEXE\APP\ORACLE\ORADATA\XE\CONTROL.D ATA\XE\CONTROL.DBF’ BF’ SCOPE = SPFILE; System Altered SQL> SHUTDOWN Immediate SQL> SHUTDOWN Database closed Database dismounted ORACCLE instance shut down Copy your old control file on new control file location and rename it SQL>  !cp C:\ORACLEXE\APP\ORACLE\O SQL> C:\ORACLEXE\APP\ORACLE\ORADATA\XE\CONTROL.D RADATA\XE\CONTROL.DBF BF C:\ORACLEXE\APP\ORACLE\ORADATA\CONTROL1.DBF SQL> Startup Total System Global Area 842384823 bytes Variable Size 138493 bytes Database Buffers 213849384 bytes Redo Buffers 5148584 bytes Database mounted. Database opened.

 

SQL> select name from v$controlfile C:\ORACLEXE\APP\ORACLE\ORADATA\XE\CONTROL.DBF C:\ORACLEXE\APP\ORACLE\ORADATA\CONTROL1.DBF Q3: Write a command to make a temporary tablespace and then make it default temporary tablespace? (20145, 20165) Making Temporary Tablespace SQL> CREATE SQL>  CREATE TEMPORARY TABLESPACE temp TEMPFILE '/oradata/mytemp_01.tmp' SIZE 20M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 16M; Making it default Temporary Tablespace SQL> ALTER SQL>  ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp; Q4: Explain row structure with diagram? (20145,)

.. Structure of a Row

 

Row data is stored in database blocks as variable-length records. Columns for a row are generally stored in the Order in which they are defined and any trailing NULL columns are not stored. Note: A single byte for column length is required for non-trailing NULL columns. Each row in a table has: Row header: Used header: Used to store the number of columns in the row, the chaining information, and the row lock Status Row data: For data: For each column, the Oracle server s erver stores the column length and value (One byte is needed to Store the column length if the column will require more than 250 bytes of storage in which case three bytes will be used for column length. The column val value ue is stored immediately following the column length bytes.) Adjacent rows do not need any space between them. Each row in the block has a sslot lot in the row directory. The directory slot points to the beginning of the row.

1.  2.  1.  2.  

Q5: Give a comparison of B-TREE index and BITMAP index? (2014 5,) ... Internally, a bitmap and a btree indexes are very different, but functionally they are identical in that they serve to assist Oracle in retrieving rows faster than a full-table scan. The basic differences between b-tree and bitmap indexes include: 1: Syntax differences:  differences:  The syntax of a b-tree index doesn’t need any keyword to say it is a b-tree index, as it’s the default: CREATE INDEX idx_emp_id  idx_emp_id  ON employee (id id); );   A bitmap index would need the keyword BITMAP: CREATE BITMAP INDEX idx_emp_gender idx_emp_gender   ON employee( employee(gender gender); );   2: Cardinality differences: The differences: The bitmap index is generally for columns with lots of duplicate values (low cardinality), while b-tree indexes are best for high cardinality columns. 3: Internal structure differences: The differences: The internal structures are quite different. A b- tree index has index nodes (based on data block size), it a tree form: The Oracle b-tree index The oldest and most popular type of Oracle indexing is a standard b-tree index, which excels at servicing simple queries. The b-tree index was introduced in the earliest releases of Oracle and remains widely used with Oracle. B-tree indexes are used to

 

avoid large sorting operations. For example, a SQL query requiring 10,000 rows to be presented in sorted order will often use a b-tree index to avoid the very large sort required to deliver the data to the end user. Oracle offers several options when creating an index using the default b-tree structure. It allows you to index on multiple columns (concatenated indexes) to improve access speeds. Also, it allows for individual columns to be sorted in different orders. For example, we could create a b-tree index on a column called last_name in ascending order and have a second column within the index that displays the salary column in descending order. create index name_salary_idx on person(last_name asc, salary desc); While b-tree indexes are great for simple queries, they are not very good for the following situations: • Low-cardinality columns - Columns with less than 200 distinct values do not have the selectivity required in order to benefit from standard b-tree index structures. • No support for SQL functions - B-tree indexes are not able to support SQL queries using Oracle's built-in functions. Oracle provides a variety of built-in functions that allow a llow SQL statements to query on a piece of an indexedcolumn or on any one of a number of transformations against the indexed column. • Bitmapped indexes • Oracle bitmap indexes are very different from standard b-tree indexes. In bitmap structures, a two-dimensional array is created with one column for every row in the table being indexed. Each column represents a distinct value within the bitmapped index. This two-dimensional array represents each value within the index multiplied by the number of rows in the table. At rowretrieval row retrieval time, Oracle decompresses the bitmap into the RAM data buffers so it can be rapidly scanned for matching values. These matching values are delivered to Oracle in the form of a Row-ID list, and these Row-ID values may directly access the required information. • The real benefit of bitmapped indexing occurs when one table includes multiple bitmapped indexes. Each individual column may have low cardinality. The creation of multiple bitmapped indexes provides a very powerful method for rapidly answering difficult SQL queries. • For example, assume there is a motor vehicle database with numerous low- cardinality columns such as car_color, car_make, car_model, and car_year. Each column contains less than 100 distinct values by themselves, and a b-tree index would be fairly useless in a

 

database of 20 million vehicles. However, combining these indexes together in a query can provide blistering response times a lot faster than the traditional method of reading each one of the 20 million rows in the base table. For example, assume we wanted to find oldblue Toyota Corollas manufactured in 1981. • select license_plat_nbr from vehicle and make = 'toyota' and year = 1981; • Oracle uses a specialized optimizer method called a bitmapped index merge to service this query. In a bitmapped index merge, each Row-ID, or RID, list is built independently by using the bitmaps, and a special merge routine is used in order to compare the RID lists and find the intersecting values. Q6: Differentiate between immediate and deffered constraints? (2014 5,) Immediate constraints: Immediate constraints: Immediate constraints, also known as non-deferred constraints are the constraints which are enforced at the end of every database DML statement. A constraint constraint violation causes the statement to be rolled back. If the constraint causes an action such as delete cascade, then the the action is taken as part of the statement that caused it. This type of constraint can be modified to be enforced at the end e nd of a transaction.  ALTER SESSION SET CONSTRAINT [S] ={IMMEDIATE|DEFERRED|DEFAULT} Deferred Constraints: Deferred Constraints: Deferred constraints are the constraints which are checked only when a transaction is committed. If any constraints violation are occurred at the commit, the entire transaction is rolled back. These constraints are most useful when both the parent and child rows in a foreign key relationship are entered at the same time, as iin n case of an order entry system, where the ordered are entered at the same time. Defining the constraints:  ALTER SESSION SET CONSTRAINT [S]={IMMEDIATE|DEFERRED|DEFAULT}

Q1: Mr. Asif has configured a database in archiving mode. On 01 Feb 2008, a datafile “File1” containing the data of Accounts Department has lost for which he has never backup. Write down the steps and commands required to be implemented by Mr. Asif to recover the datafile Write a recovery steps with command. When database running in Archive log mode and database initially closed. (2015 5,) transaction ends Step 1: Take 1: Take the datafile or tablespace offline recovery. Confirm the recovery states by quering v recovery. SQL> SELECT * FROM v$recover_file;

 

Step 2: Recover 2: Recover datafile SQL> ALTER DATABASE CREATE datafile ‘/disk2/DATA/df1.dbf’ 2>as ‘/disk1/DATA/df1.dbf’ Step3: Applying Step3:  Applying archived and online redo log files to the recreated datafile SQL> RECOVER TABLESPACE table_data Step 4: Bring 4: Bring the datafile or tablespace online SQL>ALTER TABLESPACE table data ONLINE; Q2: Mr. Jamshaid is working as DBA in ABC(Pvt) Ltd. He has successfully updated the payroll database today (31 Jan 2008). Unfortunately, some other user has dropped the tablespace containing the important salary tables at 11:15 PM. Write down steps and commands which will be implemented by Mr. Jamshaid to recover the important tables (20155,) Step 1: Shut down & backup Step 2: Restore All Data Files Step 3: Mount the Database Step 4: Recover the Database SQL> recover database Step 5: Open with reset logs SQL>Alter Database open reset logs; SQL>Archive log list; Step 6: Backup the database. Q3: Add redolog member(log01.rdo, log02.rdo) to each group(Froup1, Group2) in your database located on “mydb” (20155, 20175) To add redolog member to group we can use “Alter Database” command ALTER DATABASE ADD LOGFILE MEMBER ‘$mydb/ORACLEDATA/uO4/log01.rdo’ to Group1 ‘$mydb/ORACLEDATA/uO4/log01.rdo’ ‘$mydb/ORACLEDATA/uO4/log01.rdo’ ‘$mydb/ORACLEDATA/ uO4/log01.rdo’ to Group2 ‘$mydb/ORACLEDATA/uO4/log02.rdo’ ‘$mydb/ORACLEDATA/ uO4/log02.rdo’ to Group1 ‘$mydb/ORACLEDATA/uO4/log03.rdo’ ‘$mydb/ORACLEDATA/ uO4/log03.rdo’ to Group2 Q4: Create Table space with name “user01” locally managed with uniform size extends (20155, 20175) CREATE TABLESPACE user01 DATAFILE 'c:\Oracle\Oradata\TSH1\user01.dbf' 'c:\Oracle\Oradata\TSH1\user01.dbf' SIZE 50M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;

 

 

Q1: Differentiate between PFILE and SPFILE (2015 5, 20175) 1. SPFILE persistent server-side binary 1. PFILE is Static, client-side text file.   file. 2.   The PFILE is read at instance startup 2.  SPFILE is a binary file that contains time to get specific instance the same information as the old characteristics. PFILE. 3.  The PFILE is text based and can be 3.  Spfile can not be edited using a text edited in an editor like vi on UNIX or editor. Instead it can only be altered Notepad on Windows. using the “”ALTER SYSTEM”” 4.  Any changes that were made in PFILE command would only take effect when the 4.  SPFILE permits dynamic changes database is restarted. without requiring you to restart that 5.  .... instance. 6.  PFILE Cannot be backed up by 5.  It is easy to locate SPFILE as it is RMAN. stored in a central location. 6.  SPFILE can be backed up by RMAN.

 

Q2: Explain the process of user statement in shared server environment with the help of diagram? (20155,)

take  take  How a Request is Processed l. A user sends a request to its dispatcher. 2. The dispatcher places the request into the request queue in the System Global Area (SGA). 3. A shared server picks up the request from the request queue and processes the request. 4. The shared server places the response on the calling dispatcher's response queue. 5. The response is handed off to the dispatcher. 6. The dispatcher returns the response to the user.

 

Once the user call has been completed, the shared server process is released and is available to service another user call in the request queue. Request Queue One request queue is shared by all dispatchers. dis patchers. Shared servers monitor the request queue for new requests. • Requests are processed on a first-in, first-out (FIFO) basis. servers place all completed requests on the calling di Each dispatcher has its own response queue in the SGA. Each dispatcher is responsible for sending completed requests back to the appropriate user process. Users are connected to the same dispatcher for the duration of a session. Q4: what is the effect of protection/safety measures taken by DBA on performance of database? Explain with an example? (20155,)   Speed of the database will slow down   Recovery process can be possible   Only authorized person can access • • • •

  Database will be protected from attacks   More Storage space is required for backup



Q5: What is the purpose of cache? How DB Buffer cache work in oracle? Give some suggestion to improve it? (20155,) Purpose of Cache:  Cache:  Caching is the process of storing data in memory instead of disks. Accessing memory is far quicker than accessing hard drives. Oracle Database Cache improves the scalability and performance of applications that access Oracle databases by caching frequently used data on a middle-tier system. With Oracle Database Cache, Cache, your applications can process several times as many requests as their original or iginal capacity. Working of DB Buffer Cache: When a request is made to Oracle to retrieve data, Oracle will first check the internal memory structures to see if the data is already in the buffer. In this fashion, Oracle avoids doing unnecessary I/O. It would be ideal if you could create one buffer for each database page, ensuring that Oracle would read each block only once. However, the cost of memory in the real world makes this prohibitive. Buffer Cache is organized into two lists Write List  List  Write list contains dirty buffers. These are the data blocks which contain modified data and needed to be written to datafiles. Least Recent Used (LRU) List  List 

 

Buffers owned by LRU list are categorized into Pinned Pinned ,  , Clean Clean,, Free or Unused and Unused and Dirty buffers.. Pinned buffers Pinned buffers  buffers are currently being used while Clean Clean buffer  buffer are available for use. Although Clean Clean buffers  buffers contain some data but it is sync with block content stored in datafiles, so there is no need to write these buffer to disk. Free buffer are empty and haven’t been used yet. Dirty buffers are those which needed to be moved to write list. li st. When oracle server process requires a specific data block, it first searches it in Buffer cache. If it finds required block, it is directly accessed and this event is known as Cache Hit. If searching in Buffer cache fails then it is read from datafile on the disk and the event is called Cache Miss. If the required block is not found in Buffer cache then process needs a free buffer to read data from disk. disk.   It starts search for free buffer from least recently used end of LRU list .In process of searching, if user process finds dirty block in LRU list it shifts them to Write List. List. If the process can not find free buffers until certain amount of time then process signals DBWn process to write dirty buffers to disks. By default accessed buffers are moved to most recently used end of the LRU list. Search for free buffers is initiated from least recently used end of LRU list, this means that recently accessed buffers are kept in cache for longer time. But when a Full table scan happens, oracle process puts the blocks of table to least recently used end of LRU list. This means that they are quickly re-acclaimed by oracle process. When a table is created, a storage parameter Cache | NoCache| Cache Reads is is   required. If a table is created with Cache parameter, then the data block of tables are added to most recently used end inspite of full table scan. Suggestions to improve DB Buffer Cache: 1.  Calculating the Buffer Cache hit ration. 2.  Interpreting the buffer cache hit ratio. 3.  Increasing Memory Allocated to the database da tabase Buffer cache. 4.  Reducing Memory allocated to the database buffer cache

Q6: What is a Role? Explain different characteristics of Role? (2015 5, 20165, 20175) Role: A user privilege is a right to execute a particular type of SQL statement, or a right to access another user's object. The types of privileges are defined by Oracle Oracle.. Roles Roles,, on the other hand, are created by users (usually administrators) and are used to group together roles.. privileges or other roles administrator Roles are created by users (usually Roles are created by users (usually administrator  administrators) to group together privileges or other roles. They are a way to facilitate the granting of multiple privileges or roles to users.rs) to group together privileges or other roles. They are a way to facilitate the granting of multiple privileges or roles to users.   Characteristics

 

1. Role Authorization by the Database 2. Role Authorization by an Application 3. Role Authorization by an External SourceUSING package 4. Role Authorization by an Enterprise Directory Service Role Authorization by the Database:  Database:  The use of a role authorized by the database can be protected by an associated password. If you are granted a role protected by a password, you can enable or disable the role by supplying the proper password for the role in a SET ROLE statement. However, if the role is made a default role and enabled at connect time, the user is not required to enter a password. The following statement creates a role manager. When it is enabled, the password morework must be supplied. SQL> CREATE ROLE manager IDENTIFIED BY morework;  morework;  Role Authorization by an Application:  Application:  The INDENTIFIED USING package_name clause lets you create an application role, which is a role that can be enabled only by applications using an authorized package. Application developers do not need to secure a role by embedding passwords inside applications. Instead, they can create an application role and specify which PL/SQL package is authorized to enable the role. The following example indicates that the role admin_role is an application role and the role can only be enabled by any module defined inside the PL/SQL package hr.admin. SQL>CREATE SQL> CREATE ROLE admin_role IDENTIFIED USING hr.admin; When enabling the user's default roles at login as a s specified in the user's profile, no checking is performed for application roles. Role Authorization by an External Source: The following statement creates a role named accts rec and requires that the user be authorized by an external source before it can be enabled: SQL>CREATE SQL> CREATE ROLE accts rec IDENTIFIED EXTERNALLY; EXTERNALLY;    Role Authorization by an Enterprise Directory Service:  Service:  A role can be defined as a global role, whereby a (global) user can only be authorized to use the role by an enterprise directory service. You define the global role locally in the database by granting privileges and roles to it, but you cannot grant the global role itself to any user or other role in the database. When a global user attempts to connect to the database, the enterprise directory is queried to obtain any global roles associated ass ociated with the user. The following statement creates a global role: SQL>CREATE SQL> CREATE ROLE supervisor IDENTIFIED GLOBALLY; Global roles are one component of enterprise user management. A global role only applies to one database, but it can be granted to an enterprise role defined in the

 

enterprise directory. An enterprise role is a directory structure which contains global roles on multiple databases, and which can be granted to enterprise users. Q1: In an organization, the tablespace contain the important Salary table is drop at 10 o clock. How can we we recover our database? Write all steps, commands. commands. (20165,) 1: and begin recovery. 2: Shutdown Restore all database datafiles from backup. 3: Mount the database. 4: Recover the database. SQL> recover database until time ’10 o clock’. 5: Reset logs. SQL> alter database open resetlogs; SQL> archiving loglist; 6: make close backup. Q3: What is server process. Explain difference between dedicated and shared server (20165,) Server Process: A server process is a program that directly interact with the oracle server. Oracle creates server processes to handle the requests of user processes connected to an instance. A server process can be either a dedicated server process, where one server process services only one user process, or if your database server is configured for shared server, it can be a shared server process, where a server process can service multiple user processes. Difference between Dedicated Server & Shared Server: Dedicated Server Shared Server 1.)  When a client request is received, a new server process and a session are created for the client.  2.)  Releasing database resources involves terminating the session and server process  3.)  Memory requireme requirement nt is proportional to the number of server processes and sessions. There is one server and one session for each client. 

1.) When the first request is received from a client, the Dispatcher process places this request on a common queue. The request request is picked up by an available shared server process. The Dispatcher process then manages the communication between the client and the shared server process.  2.) Releasing database resources involves terminating the session  3.) Memory requirement is proportional

4.) Session memory is allocated from to the sum of the shared servers and the  PGA.  PGA.   memory

 

sessions. There is one session for each client.  4.) Session memory is allocated from the SGA.   SGA. Q4: What is control file? Multiplex a control file when using P FILE (2016 5,) Control File: Control File is a binary file that defines the current state of a physical da database. tabase. It is a small binary file necessary for the database to start or operate successfully. Multiplex Control File when using P File: SQL> show SQL>  show parameter pfile NAME TYPE VALUE ------------------------------------ ----------- -----------------------------spfile string C:\ORACLEXE\APP\ORACLE\PRODUCT \11.2.0\SERVER\DBS\PFILEXE.ORA SQL> select SQL>  select name from v$controlfile; NAME -------------------------------------------------------------------------------C:\ORACLEXE\APP\ORACLE\ORADATA\XE\CONTROL.DBF SQL>  ALTER SYSTEM SET CONTROL_FILES = SQL> ‘C:\ORACLEXE\APP\ORACLE\ORAD C:\ORACLEXE\APP\ORACLE\ORADATA\XE\CONTROL.D ATA\XE\CONTROL.DBF’ BF’ SCOPE = PFILE; System Altered SQL> SHUTDOWN Immediate SQL> SHUTDOWN Database closed Database dismounted ORACCLE instance shut down Copy your old control file on new control file location and rename it SQL>  !cp C:\ORACLEXE\APP\ORACLE\O SQL> C:\ORACLEXE\APP\ORACLE\ORADATA\XE\CONTROL.D RADATA\XE\CONTROL.DBF BF C:\ORACLEXE\APP\ORACLE\ORADATA\CONTROL1.DBF SQL> Startup Total System Global Area 842384823 bytes Variable Size 138493 bytes Database Buffers 213849384 bytes Redo Buffers 5148584 bytes Database mounted. Database opened.

 

  SQL> select name from v$controlfile C:\ORACLEXE\APP\ORACLE\ORADATA\XE\CONTROL.DBF C:\ORACLEXE\APP\ORACLE\ORADATA\CONTROL1.DBF 5

Q2: What isFile: Parameter File? How many types of parameter files in oracle? (2016 ,) Parameter   PFILE is Static, client-side text file.   The PFILE is read at instance i nstance startup time to get specific instance characteristics.   The PFILE is text based and can be edited in an editor like vi on UNIX or Notepad on Windows.   Any changes that were made in PFILE would only take effect when the database is restarted. Types of Parameter File: 1- Server Parameter Files A server parameter file is a binary file that acts as a repository for initialization parameters. The server parameter file can reside on the machine where the Oracle database server executes. Initialization parameters stored in a server parameter file are persistent, in that any changes made to the parameters while an instance is running can persist across instance shutdown and startup. 2- Initialization Parameter Files An initialization parameter file is a text file that contains a list of initialization parameters. The file should be written in the client's default character set. • •





The following are sample entries in an initialization parameter file:

PROCESSES = 100 OPEN_ PEN_ L I NKS = 12 GL OBAL BAL _ NAMES = t r ue The name of the initialization parameter file varies depending on the operating system. For example, it can be in mixed case or lowercase, or it can have a logical name or a variation of the name i ni t . or a. Also supplied is an i ni t dw. or a file, which contains suggested parameter settings for data warehouses and data marts. The database administrator can choose a different filename for the initialization parameter file.

Q4: Explain Index Entry Structure with Diagram? (20165,)

 

Q5: What is recovery? Write database recovery steps when database is running in NoArchive mode? (20165,) ARCHIVELOG mode is a mode that you can put the database in for creating a backup of all ARCHIVELOG mode transactions that have occurred in the database so that you can recover to any point in time. NOARCHIVELOG mode NOARCHIVELOG  mode is basically the absence of ARCHIVELOG mode and has the disadvantage of not being able to recover to any point in time. NOARCHIVELOG mode does have the advantage of not having to write transactions to an archive log and thus increases the performance of the database slightly. Step 1: Open 1: Open RMAN executable Utility on system OS. Step 2: To 2: To backup a database in NOARCHIVELOG NOARCHIVELOG mode  mode you have to shutdown shutdown it  it first, open in mount mode and only then you can start your backup process. RMAN> shutdown immediate;  immediate;  RMAN> startup mount;  mount;  Step 3: RMAN> 3: RMAN> backup database; Step 4: To check the backup is made or not enter following command RMAN> List Backup; 5

Q2: Write different stages of starting up oracle instance? (2017 ,)

An Oracle instance consists of the System Global Area (SGA) memory structure and the background processes that are used to manage a database. An instance is identified by using methods specific to each operating system. The instance can open and use only one database at a time.

Different stages of Oracle Instance An oracle instance accesses the Oracle database  It always opens one and only one database It consists of memory and background process structures

Q3: Create a locally managed tablespace? (20175,) To create a locally managed temporary tablespace, you use the CREATE TEMPORARY TABLESPACE statement, which requires that you have the CREATE TABLESPACE system privilege.

 

The following statement creates a temporary tablespace in which each extent is 16M. Each 16M extent (which is the equivalent of 8000 blocks when the standard block size is 2K) is represented by a bit in the bitmap for the file. CREATE TEMPORARY TABLESPA T ABLESPACE CE lmtemp TEMPFILE '/u02/oracle/data/lmtemp01.dbf' SIZE 20M REUSE EXTENT MANAGEMENT LOCAL UNIFORM SIZE 16M; The extent management clause is optional for temporary tablespaces because all temporary tablespaces are created with locally managed extents of a uniform size. The default for SIZE is 1 1M. M. But if you want to specify another value for SIZE, you can do so as shown in the preceding statement.

Q4: Explain the recovery procedure w.r.t Redo log files and undo Segment.? (20175,) Redo log If you do not use RMAN, then you can restore backups with operating system utilities and then run the SQL*Plus RECOVER command to recover the database. You should follow these basic steps: After identifying which files are damaged, place the database in the appropriate state for restore and recovery. For example, if some but not all datafiles are damaged, then take tthe he affected tablespaces offline while the database is open. Restore the files with an operating system utility. If you do not have a backup, it is sometimes possible to perform recovery if you have the necessary redo logs dating from the time when the datafiles were first created and the control file contains the name of the damaged file. If you cannot restore a datafile to its original location, then relocate the restore restored d datafile and change the location in the control file. Restore any necessary archived redo log files. Use the SQL*Plus RECOVER command to recover the datafile backups. For example, assume that you lose the /oracle/dbs/users1.dbf datafile, which is contained in the users tablespace, to a media failure. Also, assume that you have a backup called /dsk2/backup/users1.dbf on a separate disk drive. You discover that the datafile is missing because a query returns an error saying that the file is missing. Your first step is to take the users tablespace offline. For example, you run this SQL statement: SQL> ALTER TABLESPACE users OFFLINE IMMEDIATE; Then, you restore the backup of users1.dbf using an operating system utility. For example, you run this UNIX command: % cp /dsk2/backup/users1.dbf /oracle/dbs/users1.dbf Assuming that you have all necessary archived redo logs, you can recover the datafile with the following SQL*Plus command: SQL> RECOVER AUTOMATIC DATAFILE '/oracle/dbs/users1.dbf'; '/ oracle/dbs/users1.dbf'; Finally, bring the tablespace online as follows: SQL> ALTER TABLESPACE users ONLINE;

Undo Segment Every Oracle Database must have a method of maintaining information that is used to roll back, or undo, changes to the database. Such information consists of records of the actions of transactions, primarily before they are committed. These records are collectively referred to as undo. Undo records are used to: •  • Roll back transactions when a ROLLBACK statement is issued • 

• Recover the database

• 

• Provide read consistency

 

• 

• Analyze data as of an earlier point in time by using Oracle Flashback Query

• 

• Recover from logical corruptions using Oracle Flashback features

When a ROLLBACK statement is issued, undo records re cords are used to undo changes that we were re made to the database by the uncommitted transaction. During database recovery, undo records are used to undo any uncommitted changes applied from the redo log to the datafiles. Undo records provide read consistency by maintaining the before image of the data for users who are accessing the data at the same time that another user is changing c hanging it.

Q5: Draw a diagram of explaining relation between database physical structure and logical structure. (20175,) Oracle Database allocates logical space for all data in the database. The logical units of database space allocation are data blocks, extents, segments, and tablespaces. At a physical level, the data is stored in data files on disk. The data in the data files is stored in operating system blocks.

 

Logical Database structures Logical structures include tablespaces, schema objects, data blocks, extents and segments.

Tablespaces Database is logically divided into one or more tablespaces. Each tablespace creates cre ates one or more datafiles to physically store data.

Schema objects Schema objects are the structure that represents database's data. Schema objects include structures such as tables, views, sequences, stored procedures, indexes, synonyms, clusters and database links.

Data Blocks Data block represents specific number of bytes of physical database space on disk.

Extents An extent represents continuous data blocks that are used to store specific data information.

Segments A segment is a set of extents allocated for a certain logical structure.

Physical database structure The physical database structure comprises of datafiles, redo log files and control files

Datafiles Datafiles contain database's data. The data of logical data structures such as tables ta bles and indexes is stored in datafiles of the database. One or more datafiles form a logical unit of database storage called a tablespace.

Redo log files The purpose of these files is to record all changes made to data. These files protect database against failures. Control files Control files contain entries such as database name, name and location of datafiles and redo log files and time stamp of database creation

EXTRA DATA System global area (SGA) The SGA is a group of shared memory structures, known as SGA components, that contain data and control information for one Oracle Database instance. The SGA is shared by all server and background processes. Examples of data stored in the SGA include cached data blocks and shared SQL areas. Program global area (PGA) A PGA is a memory region that contains data and control information for a server process. It is nonshared memory created by Oracle Database when a server process is started. Access to the PGA is exclusive to the server process. There is one PGA for each server process. Background processes also allocate their own PGAs. The total memory used by all individual PGAs is known as the total instance PGA memory, and the collection of individual PGAs is referred to as the total instance PGA, or just instance. Oracle Instance:

 

Every running Oracle database is associated with an Oracle instance. When a database is started on a database server (regardless of the type of computer), Oracle allocates a memory area called the System Global Area (SGA) and starts one or more Oracle processes. This combination of the SGA and the Oracle processes is called an Oracle  Oracle  instance. The memory and processes of an instance manage the associated database's data efficiently and serve the one or multiple users of the database.

ARCHIVELOG  ARCHIVELOG  It is a mode that you can put the database in for creating a backup of all transactions that have occurred in the database so that you can recover to any point in time. NOARCHIVELOG   NOARCHIVELOG It is basically the absence of ARCHIVELOG mode and has the disadvantage of not being able to recover to any point in time. NOARCHIVELOG mode does have the advantage of not having to write transactions to an archive log and thus increases the performance of the database slightly.

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF