oracle dba 面试题
- 格式:doc
- 大小:100.50 KB
- 文档页数:26
oracle dba面试题一、数据库基础知识1. 请解释什么是数据库?数据库是指按照数据模型组织、描述和存储数据的集合,在计算机科学领域中,广泛应用于数据管理和数据处理。
2. 请简要介绍关系数据库和非关系数据库的区别。
关系数据库是基于关系模型进行数据组织和管理的数据库系统,数据以表格的形式存储,并通过关系运算进行查询和操作。
而非关系数据库则不遵循关系模型,使用其他数据模型进行存储和操作,例如文档模型、键值对模型等。
3. 数据库的ACID是指什么?ACID是数据库事务的四个特性的首字母缩写,包括原子性(Atomicity)、一致性(Consistency)、隔离性(Isolation)和持久性(Durability),确保事务的正确执行和可靠性。
二、Oracle数据库管理1. 在Oracle中,如何创建表?可以使用CREATE TABLE语句来创建表,语法如下:CREATE TABLE table_name (column1 datatype constraint,column2 datatype constraint,...);2. 请简述Oracle数据库中的慢查询优化方法。
慢查询可以通过以下方法进行优化:- 使用合适的索引,提高查询性能;- 对频繁查询的表进行分区,减少搜索范围;- 优化SQL语句,避免全表扫描或使用不当的查询条件;- 在关联查询中使用合适的连接方式(如INNER JOIN、LEFT JOIN 等);- 在需要的字段上创建合适的索引,避免全表扫描;- 使用合适的数据库缓存大小,提高I/O性能。
3. 如何备份和恢复Oracle数据库?可以使用Oracle提供的RMAN(Recovery Manager)工具进行数据库备份和恢复。
备份可以使用完全备份或增量备份,恢复时可以根据备份文件进行还原和恢复数据库。
三、Oracle数据库安全1. 如何对Oracle数据库进行用户认证和授权?Oracle数据库可以使用用户名和密码进行用户认证,管理员可以通过CREATE USER语句创建新用户,并使用GRANT语句进行权限授权。
oracle dba 面试题在申请 Oracle 数据库管理员(DBA)职位时,面试是不可或缺的环节。
为了帮助您更好地准备面试,以下是一些常见的 Oracle DBA 面试题。
一、数据库管理基础1. 什么是数据库管理系统(DBMS)?Oracle 是一种 DBMS 吗?2. 请解释一下数据库实例和数据库的关系。
3. 请介绍一下 Oracle 数据库的架构。
二、SQL 查询1. 在 Oracle 中,如何创建一张新表?2. 请解释一下 SELECT 语句的基本结构,并给出一个例子。
3. 如何在 Oracle 中使用子查询?4. 请解释一下连接(JOIN)的不同类型,并举例说明每种类型的使用场景。
三、数据库维护与性能优化1. 如何备份和还原 Oracle 数据库?请解释一下备份和还原的不同方法。
2. 如何进行表空间管理和数据文件扩容?3. 请介绍一下索引在数据库中的作用,并解释一下不同类型的索引。
4. 如何定位和解决数据库性能问题?四、故障诊断与恢复1. 当数据库实例无法启动时,你会采取哪些步骤进行故障诊断和修复?2. 数据库发生崩溃时,如何进行恢复操作?3. 请解释一下日志文件的作用,并介绍一下 Oracle 中的日志文件类型。
五、安全管理1. 请介绍一下 Oracle 数据库的权限管理机制。
2. 如何创建和管理用户账号?3. 如何实施数据库备份的安全措施?六、高可用和灾备设计1. 请解释一下 Oracle 数据库的高可用性解决方案,并介绍一下Dataguard 的作用。
2. 如何配置 Oracle RAC(Real Application Cluster)?七、常见错误和故障排除1. 当出现 ORA-00942 错误时,你会怎么做?2. 如何排查表空间占用过多的问题?3. 当数据库出现死锁时,如何解决?八、版本迁移和升级1. 当需要将 Oracle 数据库迁移到新环境时,你会采取哪些步骤?2. 如何进行 Oracle 数据库的版本升级?以上是一些常见的 Oracle DBA 面试题,希望能对您的面试准备有所帮助。
oracle 运维dba面试题Oracle运维DBA面试题在Oracle数据库管理领域,DBA(Database Administrator)是一个非常重要的角色,负责数据库的运维和管理工作。
Oracle运维DBA面试题旨在考察候选人对Oracle数据库的理解和实际操作经验。
以下是一些常见的Oracle运维DBA面试题。
1. 请解释Oracle数据库的体系结构。
Oracle数据库的体系结构由三个主要组件组成:实例(Instance)、数据库(Database)和Oracle进程(Process)。
实例负责管理数据库的内存和进程,数据库是数据的物理存储,而Oracle进程则是实例与数据库之间的桥梁。
2. 请解释Oracle重做日志(Redo Log)的作用。
Oracle重做日志是用于数据库恢复和故障恢复的关键组件。
它记录了发生在数据库中的所有修改操作,包括插入、更新和删除。
在系统故障时,通过重做日志可以恢复数据库到最后一次提交之前的状态。
3. 请解释Oracle数据文件(Data File)的作用。
Oracle数据文件是用于存储的最基本的文件单元。
它们包含了表、索引、表空间和其他数据库对象的实际数据。
每个表空间可以包含一个或多个数据文件。
4. 请解释Oracle表空间(Tablespace)的作用。
Oracle表空间是逻辑存储结构,用于管理和组织数据库对象,如表、索引和存储过程等。
一个表空间可以包含多个数据文件,每个数据文件可以属于一个表空间。
5. 请解释Oracle的归档模式(Archivelog Mode)和非归档模式(Noarchivelog Mode)的区别。
归档模式下,Oracle会将重做日志分为在线重做日志和归档重做日志。
在线重做日志用于实时记录数据库的修改操作,而归档重做日志用于数据库备份和恢复。
非归档模式下,Oracle只使用在线重做日志,无法进行数据库的归档备份和恢复。
6. 请解释Oracle的数据块(Data Block)是什么。
Oracle笔试题 oracle DBA 面试题及答案(国外公司)oracle数据库笔试题 DBA国际大公司Oracle 面试笔试题oracle Database DBA Interview Questions1. How many memory layers are in the shared pool?2. How do you find out from the RMAN catalog if a particular archive log has been backed-up?3. How can you tell how much space is left on a given file system and how much space each of the file system"s subdirectories take-up?4. Define the SGA and:? How you would configure SGA for a mid-sized OLTP environment?? What is involved in tuning the SGA?5. What is the cache hit ratio, what impact does it have on performance of an oracle database and what is involved in tuning it?6. Other than making use of the statspack utility, what would you check when you are monitoring or running a health check on an oracle 8i or 9i database? oracle Database7. How do you tell what your machine name is and what is its IP address?8. How would you go about verifying the network name that the local_listener is currently using?9. You have 4 instances running on the same UNIX box. How can you determine which shared memory and semaphores are associated with which instance?10. What view(s) do you use to associate a user"s SQLPLUS session with his o/s process?Oracle DBA面试题更新 oracle DBA 面试题更新数据库切换日志的时候,为什么一定要发生检查点?这个检查点有什么意义?表空间管理方式有哪几种,各有什么优劣。
题目内容:1 以下权限哪个是系统权限?A.ALTERB.EXECUTEC.PREFERENCESD.BACKUP ANY TABLE答案 D2 以下哪个权限是对象权限?A.INDEXB.DROP USERC.CREATE SESSIOND.BACKUP ANY TABLE答案 A3 以下哪个视图可以查到用户具有使用权限的表的信息ER_VIEWSER_TABLESC.ALL_OBJECTSER_OBJECTS答案 C4 .简述带前缀的视图的区别:V$,DBA_,ALL_,USER_ 答案:V$开头的是描述实例运行的动态性能视图,DBA_,数据库中数据字典的信息ALL_,用户具有操作权限的对象信息USER_,用户所拥有的对象的信息5 数据定义语言是一种方法,用于:A 确保数据的精确性B 定义和储存数据对象C 帮助查看数据D 储存数据6 关系定于为A 网络之间的关系B 实体之间的关系C 属性之间的关系D 对象之间的关系7 下列哪个表可以用来查询所有的索引A ALL_INDEXES_TABLESB ALL_INDEXESC INDEX_TABLESD 以上都不是8 _____数据字典表可以用来查看抽象数据类型的实际结构.A USER_TYPE_ATTRSB USER_TABLESC USER_TYPE_TABSD USER_OBJECT9 哪个初始化参数在数据库创建后无法改变A DB_NAMEB DB_BLOCK_SIZEC DB_CACHE_SIZED SHARED_POOL_SIZE10 现在要启动数据库,那么下面哪一个启动语句是错误的A STRATUP NORMALB STRATUP FORCEC STRATUP NOMOUNTD STARTUP MOUNT11 使用哪一条SHUTDOWN语句关闭数据库时,下次打开数据库是需要做恢复操作?A SHUTDOWN TRANSACTIONALB SHUTDOWN IMMEDIATEC SHUTDOWN ABORTD SHUTDOWN NORMAL12 关于数据库存储结构说法正确的是A oracle始终都只能以块作为存储单位B oracle是以块为基本存储单位,然后将块组合成区,再将区合为段,最后再由表空间对这些段进行管理。
OracleDBA面试题及参考答案OracleDBA面试题及参考答案 it工作市场是如此的紧张,每个可获得的职位都有一堆人在申请。
naveen nahata为oracle e-business suite的数据库管理员申请者提供了以下一些面试时的技术问题,它可以帮助申请者们快速脱颖而出。
问题1如果信息采集管理系统(icm)崩溃了怎么办?2你如何加速打补丁的过程?3打补丁的过程中出错了,你怎么办?4请提供克隆过程和克隆之后采取的手工操作的大概步骤。
5介绍一下autoconfig。
autoconfig是如何知道xml文件中的哪个树脂需要被放入哪一个文件的?6你能告诉我,你对一个发生故障的自服务登录问题做哪些测试吗?你要检查哪个配置文件操作选项和文件?7如果你不能看到并发管理日志和输出文件,是哪里出错了?8你是如何更改并发管理日志和输出文件的位置的?9如果用户正遇到性能方面的问题,你如何找到问题的原因?10你如何更改应用程序的密码?11请写出dbc文件的位置,并且解释它的重要性和应用程序如何知道dbc文件名?答案1所有其他的管理器都会继续工作。
icm只会处理队列控制请求,意思是开启和关闭其他并发的管理器。
22.1你可以合并多个补丁。
2.2你可以为一个非交互的补丁创建一个响应文件。
2.3你可以通过选项(nopiledb, nomaintainmrc, nopilejsp)来应用补丁,并且在应用了所有的补丁之后,一次运行它们。
3 查看失败工作的日志,找到并且纠正错误,用adctrl 工具重新开启工作。
问题1如果信息采集管理系统(icm)崩溃了怎么办?2你如何加速打补丁的过程?3打补丁的过程中出错了,你怎么办?4请提供克隆过程和克隆之后采取的手工操作的大概步骤。
5介绍一下autoconfig。
autoconfig是如何知道xml文件中的哪个树脂需要被放入哪一个文件的?6你能告诉我,你对一个发生故障的自服务登录问题做哪些测试吗?你要检查哪个配置文件操作选项和文件?7如果你不能看到并发管理日志和输出文件,是哪里出错了?8你是如何更改并发管理日志和输出文件的位置的?9如果用户正遇到性能方面的问题,你如何找到问题的原因?10你如何更改应用程序的密码?11请写出dbc文件的位置,并且解释它的重要性和应用程序如何知道dbc文件名?答案1所有其他的管理器都会继续工作。
推荐TOM大师的三本书《ORALE 高效设计》/《ORACLE 9i AND 10g编程艺术》/《EXPERT ONE ON ONE》要想成为一个合格的优秀的DBA,兴趣+坚持+勤奋+方法≈成功供将要面试的DBA参考一:SQL tuning 类1:列举几种表连接方式答:merge join,hash join,nested loop2:不借助第三方工具,怎样查看sql的执行计划答:sqlplusset autotrace ...utlxplan.sql创建plan_table表3:如何使用CBO,CBO与RULE的区别答:在初始化参数里面设置optimizer_mode=choose/all_rows/first_row等可以使用cbo.<br />rbo会选择不合适的索引,cbo需要统计信息。
4:如何定位重要(消耗资源多)的SQL答:根据v$sqlarea 中的逻辑读/disk_read。
以及寻找CPU使用过量的session,查出当前session的当前SQL语句,或者:监控WIN平台Oracle的运行5:如何跟踪某个session的SQL答:先找出对应的'sid,serial',然后调用system_system.set_sql_trace_in_session(sid,serial,true);参考:跟踪某个会话6:SQL调整最关注的是什么答:逻辑读。
IO量7:说说你对索引的认识(索引的结构、对dml影响、对查询影响、为什么提高查询性能答:默认的索引是b-tree.对insert的影响.(分裂,要保证tree的平衡)对delete的影响.(删除行的时候要标记改节点为删除).对update的影响,如果更新表中的索引字段,则要相应的更新索引中的键值。
查询中包含索引字段的键值和行的物理地址。
8:使用索引查询一定能提高查询的性能吗?为什么答:不能。
如果返回的行数目较大,使用全表扫描的性能较好。
Oracle DBA Interview Questions By B G我先表达一下我做这套题的感受.这套题我花了很多时间,期间我参考了资料和其他人的答案。
题目看似很简单,我是指看上去都不应该不会。
但做起来却不那么容易(指我自己)。
我对我的回答并不满意,我希望大家能够不断更正和完善这套答案,这也是我做这套题的初衷。
Joe06/06/071. How many memory layers are in the shared pool?The shared pool consists of the library cache and the dictionary cache.2. How do you find out from the RMAN catalog if a particular archive log has been backed-up?RC_BACKUP_REDOLOG or1) backup setRMAN> list archivelog all | from ... until.....e.gRMAN> list archivelog from time 'sysdate-1'2)backupRMAN> LIST BACKUP OF ARCHIVELOG FROM SEQUENCE 1437 UNTIL SEQUENCE 1437;3. How can you tell how much space is left on a given file system and how much space each of the file system's subdirectories take-up?df – report file system disk space usage.du – summarize disk usage of each file, recursively for directories.4. Define the SGA and:System Global Area.It consists of Shared pool, Large pool, Java pool, Buffer cache, Log buffer, Nonstandard block size buffer caches, Keep and recycle buffer caches, and Streams pool.? How you would configure SGA for a mid-sized OLTP environment?Suppose only Oracle is running on the server and MTS is chosen for OLTP.Reserve 10% of RAM for UNIX/Linux or 20% of RAM for Windows. The rest of RAM is allocated to SGA.Log_buffer=3MLarge_pool_size: For dedicated Oracle server, 20-30M is enough. For MTS, the UGA will be here. Estimate parallel connection and MTS server processes.Java_pool_size=10MShared_pool_size: If all the SQL statements that sent to ORACLE are using bind variable adequately, then 300M is enough in most cases and it should greater than 100M depending on total RAM.Data buffer: All the rest RAM should be allocated to Data buffer.Below is some referenced materials related to this issue:If you only have Oracle on the server, start by reserving 10% of RAM forUNIX/Linux or 20% of RAM for Windows. With whatever RAM is left-over:SGA Sizing and PGA SizingFor dedicated Oracle servers, the maximum total RAM SGA size can be computed as follows:OS Reserved RAM -- This is RAM required to run the OS kernek and systemfunctions, 10% of total RAM for UNIX/Linux, and 20% of total RAM for Windows.Oracle Database Connections RAM -- Each Oracle connection requires OS RAM regions for sorting and hash joins. (This does not apply when using the Oraclemultithreaded server or pga_aggregate_target.) The maximum amount of RAMrequired for a session is as follows:2 megabytes RAM session overhead + sor_area_size + hash_area_size? What is involved in tuning the SGA?Check the statspack report.Check hit ratio of Data buffer. If it is less than 90%, then we need to increase the Data buffer.Check hit ratio of Shared pool. If it is less than 95%, then we need to increase the Shared pool.Check log buffer. If redo buffer allocation retries/redo entries is greater than 1%,then we need to increase log_buffer.Determine how to use keep pool and recycle pool efficiently.5. What is the cache hit ratio, what impact does it have on performance of an Oracle database and what is involved in tuning it?For the buffer cache hit ratio, it calculates how often a requested block has beenfound in the buffer cache without requiring disk access. This ratio is computed using data selected from the dynamic performance view V$SYSSTAT. The buffer cache hit ratio can be used to verify the physical I/O as predicted byV$DB_CACHE_ADVICE.Select name, value From v$sysstatWhere name in ('db block gets', 'consistent gets', 'physical reads');The cache-hit ratio can be calculated as follows:Hit ratio = 1 - (physical reads / (db block gets + consistent gets))If the cache-hit ratio goes below 90% then:For Oracle 8 and earlier: increase the initialisation parameterDB_BLOCK_BUFFERS.For Oracle 9 onwards: increate the initialisation parameter DB_CACHE_SIZE.For the library cache hit ratio, it calculates how often the parsed representation of the statement can be reused. It also known as soft parse.Select namespace, pins, pinhits, reloads, invalidations from v$librarycache order by namespace;Library Cache Hit Ratio = sum(pinhits) / sum(pins)For the Dictionary cache hit ratio, typically, if the shared pool is adequately sized for the library cache, it will also be adequate for the dictionary cache data.6. Other than making use of the statspack utility, what would you check when you are monitoring or running a health check on an Oracle 8i or 9i database?Daily Procedures:A.Verify all instances are upB.Look for any new alert log entriesC.Verify DBSNMP is runningD.Verify success of database backupE.Verify success of database archiving to tapeF.Verify enough resources for acceptable performanceG.Copy Archived logs to standby Database and Roll forwardH.Read DBA manuals for one hourNightly Procedures:A.Collect volumetric data – Gather statistics data7. How do you tell what your machine name is and what is its IP address?Uname –nHostname8. How would you go about verifying the network name that the local_listener is currently using?Lsnrctl statuscheck listener.ora file.Show parameter LISTENER in SQLPLUS9. You have 4 instances running on the same UNIX box. How can you determine which shared memory and semaphores are associated with which instance?IpcsSQL> oradebug setmypidSQL> oradebug ipcSQL>oradebug tracfile_name10. What view(s) do you use to associate a user's SQLPLUS session with his o/s process?v$process and v$sessionSelect a.spid from v$process a, v$session b where a.addr = b.addr andb.audsid=userenv(‘sessionid’);11. What is the recommended interval at which to run statspack snapshots, and why?The most common misuse of STATSPACK is the more is better approach. Often STATSPACK reports spans hours or even days. The times between the snapshots (the colletion points) should, in general, be measured in minutes, not hours and never days.The STATSPACK reports we like are from 15-minute interval during a busy or peak time, when the performance is at its worst. That provides a very focusedlook at what was going wrong at that exact moment in time. The problem with a very large STATSPACK snapshot window, where the time between the twosnapshorts is measured in hours, is that the events that caused seriousperformance issues for 20 minutes during peak processing don’t look so badwhen they’re spread out over an 8-hour window. It’s also true with STATSPACK that measuring things over too long of a period tends to level them off over time.Nothing will stand out and strike you as being wrong. So, when taking snapshorts, schedule them about 15 to 30 minutes(maximum) apart. You might wait 3 to 4 hours between these two observations, but you should always do them in pairsand within minutes of each other.Install statspack:Connect / as sysdbaSQL>?/rdbms/admin/spcreateTaking a Statspack snapshotSQL>Connect perfstat/passwordSQL>execute statspack.snap;orSQL>variable snap number;SQL>begin :snap:=statspack.snap; end;2 /SQL>print snapRuning the Statspack reportSQL>connect perfstat/passwordSQL>?/rdbms/admin/spreport12. What spfile/init.ora file parameter exists to force the CBO to make the execution path of a given statement use an index, even if the index scan may appear to be calculated as more costly?Two parameters will make CBO to "re-calculate" the cost of indexing, so that Index looks like a "cheaper" path.1)optimizer_index_cost_adjThe default value of 100 means that an index access to a table is just as expensive as a full table scan.On most systems, the default value of 100 should be lowered.e.g A value of 10 means that the cost of an index access path is one-tenth the normal cost of an index access path.2)optimizer_index_cachingThis value is a percentage that indicates how many blocks are found in the buffer cache when an index is read.This value is only for index blocks, not for blocks in the table that the index points to.On most systems, the default value of 0 is too low and should be altered.The same applies to this parameter.13. Assuming today is Monday, how would you use the DBMS_JOB package to schedule the execution of a given procedure owned by SCOTT to start Wednesday at 9AM and to run subsequently every other day at 2AM.SQL>Variable jobno number;SQL>Execdbms_job.submit(:jobno,’your_work’,’trunc(sysdate+2)+9/24’,’trunc(sysdate+1)+de code(to_char(sysdate+1,’DAY’),’WED’,9/24,2/24)’);14. How would you edit your CRONTAB to schedule the running of /test/test.sh to run every other day at 2PM?crontab –e* 14 */1 * * /test/test.sh15. What do the 9i dbms_standard.sql_txt() and dbms_standard.sql_text() procedures do?An appropriate answer is welcome!!!16. In which dictionary table or view would you look to determine at which time a snapshot or MVIEW last successfully refreshed?DBA_MVIEWSDBA_MVIEW_REFRESH_TIMES17. How would you best determine why your MVIEW couldn't FAST REFRESH? Use the explain_mview procedure of DBMS_MVIEW package to populatemv_capabilities_table and check capability_name and msgtxt columns.18. How does propagation differ between Advanced Replication and Snapshot Replication (readonly)?In advanced replication, multiple sites might be modifying data, it would not work to simply copy the database on a regular basis. Instead, changes are saved and queued to be run on other replication sites.19. Which dictionary view(s) would you first look at to understand or get a high-level idea of a given Advanced Replication environment?An appropriate answer is welcome!!!20. How would you begin to troubleshoot an ORA-3113 error?The ORA-3113 error is a general error reported by Oracle client tools, which signifies that they cannot communicate with the oracle shadow process. As it is sucha general error more information must be collected to help determine what has happened.Connecting to Oracle:For local connections check the following:1. Have you installed the Parallel Server Option?ORA-3113 will occur if you have installed the Parallel Server Option but do NOT have a Distributed Lock Manager installed or running.To deinstall the Parallel Server Option:Shut down any Oracle instances%script /tmp/relink.out%cd $ORACLE_HOME/rdbms/lib%rm –f oracle%make –f oracle.mk no_parropt ioracle%exit2. Try using the SQL*Net V1 driver for local connections:Setenv TWO_TASK P:Then try the client tool. If this now works you may have a problem with the default SQL*Net driver.3. Your ‘oracle executable may be corrupt. Relink it as follows:Log in as the ‘oracle’ user.%script /tmp/relink.out%cd $ORACLE_HOME/redbms/lib%rm –f oracle.mk ioracle%exit4. Some Unix platforms need LD_LIBRARY_PATH to be set correctly to resolve any dynamically linked libraries.%script /tmp/ldd.out%id%cd $ORACLE_HOME/bin%ldd oracle%exitIf the ‘ldd’ command does not exist go to the next stop below.Check that all lines listed show a full library file.For remote connections:1. Check if you can make LOCAL connections. If not then follow the steps above for LOCAL connection problems.2. Whick SQL*Net protocol are you using?For the protocol you are using check that the oracleexecutable has this linked in as follows:Log in as oracle on the server% script /tmp/drivers.out% cd $ORACLE_HOME/bin% drivers oracle% exitEg: If you are using TCP/IP it should list TCP/IP.If the drivers command does not exist on your machine, checkthe oracle executable as below substituting the relevantsymbol from Table C.1 for the word SYMBOL. If you do not receive any output then:% script /tmp/symbols.out% cd $ORACLE_HOME/bin% nm oracle | grep -i SYMBOL # Use relevant SYMBOL% exitEg: For SQL*Net TCP/IP you would use the command:% nm oracle | grep -i osntttIf the required driver is not installed you should:a) Relink Oracle (See step (B3) above).b) Re-check the oracle executable for therelevant driver. If it is still missing thenthe relevant SQL*Net driver has probably notbeen installed. Reinstall the required SQL*Netdriver.3. Check your /etc/oratab or /var/opt/oracle/oratab file is of the form: SID:/path/to/oracle/home:NAnd confirm:[ ] There are no blank lines.[ ] The PATH to ORACLE_HOME is correct and containsno environment variables.[ ] There are no ':'s in the ORACLE_HOME path.[ ] There is NOTHING at the end of the line.The last character on a line should be Y or N.There should NOT be a fourth field.An Established Connection:1) Check in your 'USER_DUMP_DEST' for any Oracle trace file. It is important to find the correct trace file. Use thecommand 'ls -ltr' to list files in time order with thelatest trace files appearing LAST. If you are not surewhich trace file may be relevant, move all the current tracefiles to a different directory and reproduce the problem.The trace file will typically be of the form 'ora_<PID>.trc'.2) If there is no trace file check for a core dump in theCORE_DUMP_DEST. Check as follows:% cd $ORACLE_HOME/dbs # Or your CORE_DUMP_DEST% ls -l core*If there is a file called core, check that its time matchesthe time of the problem. If there are directories called'core_<PID>' check for core files in each of these. It isIMPORTANT to get the correct core file. Now obtain a stacktrace from this core file. Check each of the sequences belowfor the procedure. One of the following should work for yourplatform:If you have dbx:% script /tmp/core.stack% dbx $ORACLE_HOME/bin/oracle core(dbx) where...(dbx) quit% exit3) Try to obtain any SQL*Net trace to show what the latestoperation sent to the oracle process was.For SQL*Net V1 check which SQL*Net protocol you are usingand note the Debug environment variable from table C1 above.Then catch SQL*Net trace from the client. Eg: For SQL*NetTCP/IP and sqlplus:% setenv OSNTDBUG -1 # Use correct OSN*DBUGvariable% sh% sqlplus scott/tiger@t:hostname:sid 2>/tmp/net1.out21. Which dictionary tables and/or views would you look at to diagnose a locking issue? v$lock, v$session, DBA_DDL_LOCKS, v$enqueue_lock, dba_locks22. An automatic job running via DBMS_JOB has failed. Knowing only that "it's failed", how do you approach troubleshooting this issue?check the error no with alert_log or jobq trace file.A better answer is expected!!!23. How would you extract DDL of a table without using a GUI tool?Exp rows=n tables=()Imp indexfile=test.sqlSelect dbms_metadata.get_ddl(‘table_name’,’owner’,’TABLE’) from dual;24. You're getting high "busy buffer waits" - how can you find what's causing it?1) Find the hot block and the segment these hot blocks belong to. X$BH andDBA_OBJECTS2) Find related SQL statementSelect sql_address from v$session where sid=;Select * from v$sqltest where address=;3) Tune itYou can get ‘busy buffer waits’ from event column of v$session_waitSome important event:buffer busy waits,free buffer waits,db file sequential read,db file scattered read, latch free25. What query tells you how much space a tablespace named "test" is taking up, and how much space is remaining?Select sum(bytes) from dba_extents where tablespace_name=’TEST’ group by tablespace_name;Select sum(bytes) from dba_free_space where tablespace_name=’TEST’ group by tablespace_name;26. Database is hung. Old and new user connections alike hang on impact. What do you do? Your SYS SQLPLUS session IS able to connect.1) First view active sessions and v$session_wait2) See the uptime and top processes of the system27. Database crashes. Corruption is found scattered among the file system neither of your doing nor of Oracle's. What database recovery options are available? Database is in archive log mode.Instance recovery28. Illustrate how to determine the amount of physical CPUs a Unix Box possesses (LINUX and/or Solaris)。
[转帖]DBA笔试题一:SQL tuning 类1:列举几种表连接方式2:不借助第三方工具,怎样查看sql的执行计划3:如何使用CBO,CBO与RULE的区别4:如何定位重要(消耗资源多)的SQL5:如何跟踪某个session的SQL6:SQL调整最关注的是什么7:说说你对索引的认识(索引的结构、对dml影响、对查询影响、为什么提高查询性能)8:使用索引查询一定能提高查询的性能吗?为什么9:绑定变量是什么?绑定变量有什么优缺点?10:如何稳定(固定)执行计划11:和排序相关的内存在8i和9i分别怎样调整,临时表空间的作用是什么12:存在表T(a,b,c,d),要根据字段c排序后取第21—30条记录显示,请给出sql 二:数据库基本概念类1:pctused and pctfree 表示什么含义有什么作用2:简单描述table / segment / extent / block之间的关系3:描述tablespace和datafile之间的关系4:本地管理表空间和字典管理表空间的特点,ASSM有什么特点5:回滚段的作用是什么6:日志的作用是什么7:SGA主要有那些部分,主要作用是什么8racle系统进程主要有哪些,作用是什么三:备份恢复类1:备份如何分类2:归档是什么含义3:如果一个表在2004-08-04 10:30:00 被drop,在有完善的归档和备份的情况下,如何恢复4:rman是什么,有何特点5:standby的特点6:对于一个要求恢复时间比较短的系统(数据库50G,每天归档5G),你如何设计备份策略四:系统管理类1:对于一个存在系统性能的系统,说出你的诊断处理思路2:列举几种诊断IO、CPU、性能状况的方法3:对statspack有何认识4:如果系统现在需要在一个很大的表上创建一个索引,你会考虑那些因素,如何做以尽量减小对应用的影响5:对raid10 和raid5有何认识五:综合随意类1:你最擅长的是oracle哪部分?2:喜欢oracle吗?喜欢上论坛吗?或者偏好oracle的哪一部分?3:随意说说你觉得oracle最有意思的部分或者最困难的部分4:为何要选择做DBA呢?参考解答:一:SQL tuning 类1:列举几种表连接方式/jbgh608/blog/item/92e09c81562a369df703a650. html2:不借助第三方工具,怎样查看sql的执行计划/jbgh608/blog/item/27ef8128192a49f7e7cd4051.h tml3:如何使用CBO,CBO与RULE的区别在optimizer_mode=choose时,如果表有统计信息(分区表外),优化器将选择CBO,否则选RBO。
RBO遵循简单的分级方法学,使用15种级别要点,当接收到查询,优化器将评估使用到的要点数目, 然后选择最佳级别(最少的数量)的执行路径来运行查询。
CBO尝试找到最低成本的访问数据的方法,为了最大的吞吐量或最快的初始响应时间,计算使用不同的执行计划的成本,并选择成本最低的一个,关于表的数据内容的统计被用于确定执行计划。
4:如何定位重要(消耗资源多)的SQL/jbgh608/blog/item/7f29a28cc70d24e3f11f3605.ht ml5:如何跟踪某个session的SQL/jbgh608/blog/item/5bdd765a54ec9c262934f0ac.h tml6:SQL调整最关注的是什么查看该SQL的response time(db block gets/consistent gets/physical reads/sorts (disk))调整的目的就是为了消耗最小的资源来完成功能,通过查看执行计划和各种统计信息来分辨调整后的sql对资源的耗费情况,来找出一个成本最小的sql语句。
7:说说你对索引的认识(索引的结构、对dml影响、为什么提高查询性能)b-tree index/bitmap index/function index/patitional index(local/global) 索引通常能提高select/update/delete的性能,会降低insert的速度,索引就是一种特殊的查询表数据库的搜索引擎可以利用它加速对数据的检索,就像书的目录不需要查询整本书就可以找到想要的数据。
8:使用索引查询一定能提高查询的性能吗?为什么/jbgh608/blog/item/a9e883c98c82638ac8176835.html 9:绑定变量是什么?绑定变量有什么优缺点?绑定变量是指在SQL语句中使用变量,改变变量的值来改变SQL语句的执行结果。
优点:使用绑定变量,可以减少SQL语句的解析,能减少数据库引擎消耗在SQL 语句解析上的资源。
提高了编程效率和可靠性。
减少访问数据库的次数, 就能实际上减少ORACLE的工作量。
缺点:经常需要使用动态SQL的写法,由于参数的不同,可能SQL的执行效率不同;绑定变量是相对文本变量来讲的,所谓文本变量是指在SQL直接书写查询条件,这样的SQL在不同条件下需要反复解析,绑定变量是指使用变量来代替直接书写条件,查询bind value在运行时传递,然后绑定执行。
优点是减少硬解析,降低CPU的争用,节省shared_pool ;缺点是不能使用histogram,sql优化比较困难10:如何稳定(固定)执行计划可以在SQL语句中指定执行计划。
使用HINTS;query_rewrite_enabled = truestar_transformation_enabled = trueoptimizer_features_enable = 9.2.0创建并使用stored outline11:和排序相关的内存在8i和9i分别怎样调整,临时表空间的作用是什么8i中sort_area_size/sort_area_retained_size决定了排序所需要的内存如果排序操作不能在sort_area_size中完成,就会用到temp表空间9i中如果workarea_size_policy=auto时,排序在pga内进行,通常pga_aggregate_target的1/20可以用来进行disk sort;如果workarea_size_policy=manual时,排序需要的内存由sort_area_size决定在执行order by/group by/distinct/union/create index/indexrebuild/minus等操作时,如果在pga或sort_area_size中不能完成,排序将在临时表空间进行(disk sort),临时表空间主要作用就是完成系统中的disk sort.12:存在表T(a,b,c,d),要根据字段c排序后取第21—30条记录显示,请给出sqlcreate table t(a number(,b number(,c number(,d number();/beginfor i in 1 .. 300 loopinsert into t values(mod(i,2),i/2,dbms_random.value(1,300),i/4);end loop;end;/select * from (select c.*,rownum as rn from (select * from t order by c desc) c) where rn between 21 and 30;/select * from (select * from test order by c desc) x where rownum < 3 0minusselect * from (select * from test order by c desc) y where rownum < 2 0 order by 3 desc相比之minus性能较差数据库基本概念类1:pctused and pctfree 表示什么含义有什么作用/jbgh608/blog/item/ff079401c60b18024afb51c8.html 2:简单描述table / segment / extent / block之间的关系table创建时,默认创建了一个data segment,每个data segment含有min extents指定的extents数,每个extent据据表空间的存储参数分配一定数量的blocks3:描述tablespace和datafile之间的关系一个tablespace可以有一个或多个datafile,每个datafile只能在一个tablespace内,table中的数据,通过hash算法分布在tablespace中的各个datafile 中,tablespace是逻辑上的概念,datafile则在物理上储存了数据库的种种对象。
4:本地管理表空间和字典管理表空间的特点,ASSM有什么特点本地管理表空间(Locally Managed Tablespace简称LMT)8i以后出现的一种新的表空间的管理模式,通过位图来管理表空间的空间使用。
字典管理表空间(Dictionary-Managed Tablespace简称DMT)8i以前包括以后都还可以使用的一种表空间管理模式,通过数据字典管理表空间的空间使用。
自动段空间管理(ASSM),它首次出现在Oracle920里有了ASSM,链接列表freelist被位图所取代,它是一个二进制的数组,能够迅速有效地管理存储扩展和剩余区块(free block),因此能够改善分段存储本质,ASSM表空间上创建的段还有另外一个称呼叫Bitmap Managed Segments(BMB 段)。
5:回滚段的作用是什么事务回滚:当事务修改表中数据的时候,该数据修改前的值(即前影像)会存放在回滚段中,当用户回滚事务(ROLLBACK)时,ORACLE将会利用回滚段中的数据前影像来将修改的数据恢复到原来的值。
事务恢复:当事务正在处理的时候,例程失败,回滚段的信息保存在undo表空间中,ORACLE将在下次打开数据库时利用回滚来恢复未提交的数据。
读一致性:当一个会话正在修改数据时,其他的会话将看不到该会话未提交的修改。
当一个语句正在执行时,该语句将看不到从该语句开始执行后的未提交的修改(语句级读一致性)当ORACLE执行SELECT语句时,ORACLE依照当前的系统改变号(SYSTEM CHANGE NUMBER-SCN)来保证任何前于当前SCN的未提交的改变不被该语句处理。
可以想象:当一个长时间的查询正在执行时,若其他会话改变了该查询要查询的某个数据块,ORACLE将利用回滚段的数据前影像来构造一个读一致性视图。