oracle interview basis

1 For an existing system, system performance, tell your diagnosis and treatment ideas

1 ). Statspack do collect information about the system to understand the system the general situation / place to determine whether there is an inappropriate parameter settings / Viewing Top 5  Event / View top sql, etc.

2 ). Charles v $ system_event / v $ session_event / v $ session_wait start from v $ system_event, determine what resources are needed (db file sequential read) and so on, 
in-depth study of v $ session_event, determined to wait for the session involved in the incident, from v $ session_wait detail of the determined resource contention (p1-p3 value: file_id / BLOCK_ID / Blocks, etc.) 3 ) through v $ sql / v $ sqltext / v $ sqlarea table to determine disk_reads, (buffer_gets / executions) larger value SQL
2 . The method cited several diagnostic IO, CPU, performance status

top   uptime   vmstat   iostat   statspack   sql_trace/tkprof

查v$system_event/v$session_event/v$session_wait

Charles v $ sqlarea (disk_reads or BUFFER_GETS / Executions larger SQL)

Or third-party monitoring tools, TOAD pretty good.
3 . What is the understanding of the statspack

StapSpack is an Oracle company offers packages collection database running performance indicators . You can do database health check report .
StapSpack package is a collection of Oracle database running performance indicators provided by the company, the package from 8i onwards, in 9i, 10g has significantly enhanced
The package of auxiliary table (table of storage-related performance parameters collected) growth from the initial 25-43

Collecting parameters from the original level 3 ( 0 , 5 , 10 ) increased to five ( 0 , 5 , 6 , 7 , 10 ) 
by analyzing the performance metrics collection, database administrators to understand in detail the current operation of the database, the database instance, waiting for the event, SQL and other adjustments to optimize the 
use of snapshot statspack collected , can count trend graphs various performance indicators of statistical production database .
4 . If the system now need to create an index on a large table, you will consider those factors, how to do to minimize the impact of the application of

You can first analyze the table, and then create a test before and after the impact of application performance index;
Need to consider is when the index column is not updated often, there are not many cases duplicate values, 
Particularly effective use of indexes in large table. Creating an index can be divided into different tables with space to store the data table.
When the system is relatively idle nologging option (if you can not use dataguard nologging) sort_ared_size large or larger pga_aggregate_target
5 . Interpretation differs from the cold and hot backup, and the respective advantages

Hot backup mode for database archiving, backup while the database is still in working condition.
After the cold backup database means closed, backup, database applicable to all modes.

Hot backup advantages : that, when the backup, the database may be used and still, can restore the database to a point at any time. 
Cold backup advantages : that it is quite simple backup and restore operations, and since the cold backup database can work in a non-filing mode, performance is slightly better than database archive mode.
(Because the do not have to archive log write hard disk)
Compare truncate and delete command 6.
Both can be used to delete all records in the table. Except that: truncate is DDL operation, it moves HWK, you do not need to rollback segment.
The Delete is DML operations, and the need to rollback segment takes a long time.

7 . How to increase the buffer cache hit rate?

When the database busier for buffer cache advisory tool, query v $ db_cache_advice. 
If necessary change, System can use the ALTER the SET DB_CACHE_SIZE command
8 . What bind variables? What are the advantages and disadvantages bind variables?

Bind variables is the use of variables in SQL statements, changing the value of the variable to change the results of the implementation of the SQL statement.

Pros: using bind variables, you can reduce parse SQL statements, the database engine can reduce the consumption of resources on the SQL statement is parsed. Improve programming efficiency and reliability. 
Reduce the number to access the database, you can actually reduce the workload of ORACLE. Cons: often need to use dynamic SQL wording, due to the different parameters may be different SQL execution efficiency; Bind variables is relatively variable in terms of the text, variable text refers to the so-called direct written query in SQL, Such parsing SQL requires repeated under different conditions, bind variables are variables instead of using direct writing condition, the query bind value at run time passed, and then bind the execution. Pros: Hard parsing reduce, reduce CPU contention, save shared_pool Cons: You can not use histogram, sql optimization more difficult
9 . Pctused and PCTFREE indicate what the meaning of what role

pctfree pctused and control data block is present in the freelist,   
pctfree control data block in the space reserved for the update,
When the data block is less than the free space provided pctfree space, the block is removed from the freelist, 
when the block is greater than the free space due to the operation space dml pct_used set, the block will be added to the database list of the freelist.

10 What is the role of rollback

Rollback mapping for data stored before modification, information is read consistency for generating database information, the database used when restored and Rollback. A transaction can only use a rollback.

Rollback transaction: When the modified transaction data in the table when the value of the data before the modification (i.e., before images) will be stored in the rollback, when the user rolls back the transaction (ROLLBACK), ORACLE will benefit 
by rollback restore image data before the data to be modified to the original value. Transaction Recovery: When the transaction is being processed, the routine fails, rollback segment information stored in the undo table space, ORACLE will use to roll back the next time you open the database to recover uncommitted data. Read consistency: when a session is modifying data, another session will not see uncommitted modifications of the session. When a statement is being executed, the statement will not see from the statement after the beginning of the implementation of
modifications that were not submitted (statement-level read consistency) When performed ORACLE SELECT statement, ORACLE number changes according to the current system (the CHANGE NUMBER the SYSTEM
-SCN) to ensure that any change in current before being uncommitted SCN,
the statement is processed. Imagine: When a query is being executed for a long time, if other sessions changed a data block that query to query, ORACLE will use the image data before the rollback to
construct a read-consistent view
11 .SGA mainly those parts, what is the main role

System Global Area (SGA): ORACLE is set to a shared buffer memory allocated example, a database for storing data and control information to enable the management and operation of the database data.

SGA include:

    a) shared pool (shared pool): is used to store data recently executed SQL statements and most recently used data dictionary.
    b) data buffer (database buffer cache): used to store the most recent read through the data from the data file.
    c) redo log buffer (redo log buffer): used to record the service or daemon operation of the database.

In addition there are two optional SGA memory structures:

    d) Java pool: used for storing Java code.
    e) Large pool: memory for storing a large structure is not directly related to SQL. Backup and restore use.
    GA:db_cache/shared_pool/large_pool/java_pool

db_cache: Database Cache (Block Buffer) for the operation and performance of the Oracle database plays a key role, it occupies (shared memory system) Oracle Database SGA 
main part. Oracle database by using the LRU algorithm, the data most recently accessed blocks stored in the cache to optimize access to disk data. shared_pool: shared pool size is very important for Oracle is the performance. Save data dictionary cache and shared pool or fully resolve the compiled PL
/ SQL blocks and SQL statements
and control structures large_pool: When using the MTS configuration, because UGA in the SGA to be allocated to maintain the user's session, is to use this time to keep Large_pool session memory use RMAN to do a backup,
you want to use this memory structure Large_pool disk to do the I
/ O buffer java_pool: java procedure for the preparation of the memory area, if no java proc, java_pool not necessary
12 . Backup how to classify

Logical backup: exp / logical backup imp specified table

Physical backup:

                Hot Backup: ALTER TABLESPACE the begin / End Backup;
                Cold backup: Offline backup (database shutdown)

RMAN Backup
        Backup Full / the incremental Backup (cumulative / differences)

Physical backup

      Physical backup is the main backup. To ensure that the database be restored with minimal or no loss of the database data loss.
=============================================================================================
Cold physical

      Cold physical backup offers the simplest and most direct way to protect the database is lost due to physical damage. Recommended in the following situations.
      Most of a large amount of data in the database already exists, the database can be closed at night, when the cold physical backup application.
      The need to upgrade the database server, (e.g., replacing a hard disk), a database information to be backed up at this time, and a new 
      restore the hard disk data, recommended physical cold backup. Thermal Physics       Mainly refers to the backup process performed when the user opens and can be used in the database. If necessary to perform hot backup of physics are:       Because the database requires continuous nature of the work, and thus this case can only hot physical backup.       Because of the time required to back up too long, and the database is closed only for a short time. Logical backup (the EXP
/ Imp)       For implementing logical backup restore database objects. But not a backup strategy based on a point in time can be fully restored. Only as a supplement online backup and offline backup . Completely logical backup       Entirely logical backup is to export the entire database to a database file format , the file can be portable between different database versions, operating systems and hardware platforms. Specified logical backup table       Backup tool, you can specify the database table will back out , this waste can be avoided entirely logical backup caused by time and money.
12 .standby features

Standby (standby database): ORACLE introduced a high-availability (HIGH AVAILABLE) database program, between the master node and the backup node log 
synchronizing ensure synchronization, the standby node as a backup master node, may be achieved with the fast switch data disaster recovery
standby three data protection modes are:
. 1 ), the PROTECTION MAXIMIZE : no maximum data protection and data differences, the LGWR simultaneously transferred to the standby node, the transaction confirmation before the main node, the standby node must be completely
               received log data. If the network is not good, causing LGWR can not transmit data, it will cause serious performance problems, leading to the master node DOWN machine.
2 ), MAXIMIZE to AVAILABILITY : no data loss mode, allowing data differences and allows asynchronous transmission.                 In Run mode, maximum protection under normal circumstances, when not properly connected or disconnected in the network node and the backup master node, automatically switches to the maximum performance mode ,
                the operation of the master node or can continue. Have a greater impact in the case of network performance is not good.
. 3), MAXIMIZE the PERFORMANCE : This mode can be said to be inherited from coming 8i standby server mode, asynchronous transmission, no data synchronization check, data may be lost,
               but to obtain maximum performance of the master node. 9i default is MAXIMIZE PERFORMANCE DATA GUARD in the allocation of
13 . What business is?

A transaction is a logical unit as a series of operations performed, a logical unit of work must have four attributes, 
called ACID (atomicity, consistency, isolation and durability) properties, the only way to become a transaction: Atomicity: a transaction must be atomic unit of work; for which data modification, either all executed or not executed full. Consistency: When the transaction is completed, all data must be consistent state. In the relevant database, all rules must be applied to modify the transaction,
    in order to maintain the integrity of all data. At the end of the transaction, all of the internal data structures (such as B-tree indexes or doubly linked list) must be correct. Isolation: modified by concurrent transactions must be isolated from any modifications made by other concurrent transactions. Services view the data in which the state is either
    state before another concurrent transaction modified it, either state after another transaction modifies it, the transaction will not see an intermediate state data. This is known as serializability,
    because it can reload the initial data, and replay a series of transactions, so that the state of the state at the end of the original data and the same transaction execution. Durability: After the transaction is complete, it is the impact of the system permanent. The modification even if the system failure will remain.

14 vertical split table
  The splitting table comprising a plurality of columns into a plurality of tables, the table width solve the problem, following splitting means comprises:       The single field is not used in the same table;       The large field into a separate table;       The field is frequently used together;  The advantage of this is very obvious, including: a clear business after the split, the split rules are clear, easy to integrate or extend between systems, simple data maintenance. (
1 ) horizontal split table   Table level split for solving the data sheet data is too big problem, split level structure of each table is exactly the same. Generally, the data N tables bisects the
common methods include the following two:     Performs the hash function to the ID, if you want to split into five tables, MOD (ID,
. 5 ) taken from 0 to 4 values;     For different hashID store data in different tables;

horizontal table split will bring some problems and challenges, including the problem of cross-partition table data query, statistics and operational background reports, etc., but it also brings some real the benefits of: After segmentation may reduce the number of pages in the table query needs to read the data and indexes, but also reduces the number of layers index, speed up the search; Data in the table already has the independence, for example, data were recorded in all regions or in different periods of the table, especially in some of the data used, while other data is not commonly used. The need to store data across multiple databases and improve overall system availability.

Guess you like

Origin www.cnblogs.com/vmsysjack/p/12157847.html