search
HomeDatabaseMysql TutorialOracle数据库笔试题(附答案)

Oracle数据库笔试题(附答案)

Jun 07, 2016 pm 03:01 PM
oracledatabasetest questions

Oracle数据库笔试题(附答案)

1. 数据库切换日志的时候,为什么一定要发生检查点?这个检查点有什么意义?

答:触发dbwr的执行,dbwr会把和这个日志相关的所有脏队列写到数据文件里,缩短实例恢复所需要的时间。

【专题推荐】:2020年oracle面试题汇总(最新)

2. 表空间管理方式有哪几种,各有什么优劣。

答:字典管理方式和本地管理方式,本地管理方式采用位图管理extent,减少字典之间的竞争,同时避免了碎片。

本地管理表空间与字典管理表空间相比,其优点如下:

1).减少了递归空间管理;

2).系统自动管理extents大小或采用统一extents大小;

3).减少了数据字典之间的竞争;

4).不产生回退信息;

5).不需合并相邻的剩余空间;

6).减少了空间碎片;

7).对临时表空间提供了更好的管理。

3. 本地索引与全局索引的差别与适用情况。

答:对于local索引,每一个表分区对应一个索引分区,当表的分区发生变化时,索引的维护由Oracle自动进行。对于global索引,可以选择是否分区,而且索引的分区可以不与表分区相对应。当对分区进行维护操作时,通常会导致全局索引的INVALDED,必须在执行完操作后REBUILD。Oracle9i提供了UPDATE GLOBAL INDEXES语句,可以使在进行分区维护的同时重建全局索引。

4. 一个表a varchar2(1),b number(1),c char(2),有100000条记录,创建B-Tree索引在字段a上,那么表与索引谁大?为什么?

答:这个要考虑到rowid所占的字节数,假设char总是占用2字节的情况,比较rowid,另外,table和index在segment free block的管理也有差别。

5. Oracle9i的data guard有几种模式,各有什么差别。

答:三种模式:

最大性能(maximize performance):这是data guard默认的保护模式。primay上的事务commit前不需要从standby上收到反馈信息。该模式在primary故障时可能丢失数据,但standby对primary的性能影响最小。

最大可用(maximize availability):在正常情况下,最大可用模式和最大保护模式一样;在standby不可用时,最大可用模式自动最大性能模式,所以standby故障不会导致primay不可用。只要至少有一个standby可用的情况下,即使primarydown机,也能保证不丢失数据。

最大保护(maximize protection):最高级别的保护模式。primay上的事务在commit前必须确认redo已经传递到至少一个standby上,如果所有standby不可用,则primary会挂起。该模式能保证零数据丢失。

6. 执行计划是什么,查看执行计划一般有哪几种方式。

答:执行计划是数据库内部的执行步骤:

set autotrace on
select * from table
alter session set event '10046 trace name context forever,level 12 ';
SYS.DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION=(SID,SERIAL#,TRUE);

一般采用pl/sql developer,再加个explain plan , v$sql_plan.

7. 简单描述一下nest loop与hash join的差别。

答:nest loop适用于返回结果比较小的情况。

for in 1...n loop

对小表进行遍历

根据小表的结果遍历大表(大表需要索引)

end loop

hash join适用在返回大结果集的情况。

8. db file sequential read与db file scattered read等待的差别,如果以上等待比较多,证明了什么问题?

答:db file sequential read-DB文件顺序读取,这一事件通常显示与单个数据块相关的读取操作(如索引读取)。如果这个等待事件比较显著,可能表示在多表连接中,表的连接顺序存在问题,可能没有正确的使用驱动表;或者可能说明不加选择地进行索引。在大多数情况下我们说,通过索引可以更为快速的获取记录,所以对于一个编码规范、调整良好的数据库,这个等待很大是很正常的。但是在很多情况下,使用索引并不是最佳的选择,比如读取较大表中大量的数据,全表扫描可能会明显快于索引扫描,所以在开发中我们就应该注意,对于这样的查询应该进行避免使用索引扫描。

db file sequential read-DB檔分散读取,这种情况通常显示与全表扫描相关的等待。当数据库进行全表扫时,基于性能的考虑,数据会分散(scattered)读入Buffer Cache。如果这个等待事件比较显著,可能说明对于某些全表扫描的表,没有创建索引或者没有创建合适的索引,我们可能需要检查这些数据表已确定是否进行了正确的设置。然而这个等待事件不一定意味着性能低下,在某些条件下Oracle 会主动使用全表扫描来替换索引扫描以提高性能,这和访问的数据量有关,在CBO 下Oracle 会进行更为智能的选择,在RBO 下Oracle 更倾向于使用索引。当这个等待事件比较显著时,可以结合v$session_longops 动态性能视图来进行诊断,该视图中记录了长时间(运行时间超过6 秒的)运行的事物,可能很多是全表扫描操作(不管怎样,这部分信息都是值得我们注意的)。

9. library cache pin与library cache lock是什么地方的等待事件,一般说明什么问题?

答:"LIBRARY CACHE PIN"通常是发生在编译或重新编译PL/SQL,VIEW,TYPES等object时.

10. 在一个24*7的应用上,需要把一个访问量很大的1000万以上数据级别的表的普通索引(a,b)修改成唯一约束(a,b,c),你一般会选择怎么做,请说出具体的操作步骤与语句。

答:不能确定,是否可以采用先建索引后建约束:

create index idx_w1 on w_1 (a,b,c) online ;
alter table w_1 add constraint uni_w1 unique (a,b,c) novalidate;

11. 如果一个linux上的oracle数据库系统突然变慢,你一般从哪里去查找原因。

答:1).用vmstat,iostat命令查看系统的负载(I/O读写是否严重,CPU是否空闲).

2).用top工具查看有哪些进程CPU占用率高;

3). 查询$session_wait、v$system_event数据字典,找出当前比较严重的等待事件,并试图优化影响性能的SQL语句。

12. 说明一下对raid5与raid01/10的认识。

答:raid5采用校验信息,硬盘的利用率n-1/n, 以RAID5(4D+P)为例子来讲,使用4块磁盘存放数据位,使用1块磁盘存放校验位。其基本原理是这样的:根据条带化的数据4D(使用四位数据)生成一位的校验信息,存放在第五块磁盘中。

raid10先采用先镜像在进行条带化,是最高效的硬盘利用方式,硬盘的利用率50%,是一个Raid 0与Raid1的组合体,它是利用奇偶校验实现条带集镜像,所以它继承了Raid0的快速和Raid1的安全。

13. 列举5个10g的新特性.

答:

1).自动共享内存(SGA)管理

2).自动存储管理(ASM)

3).ADDM和查询优化器

4).闪回表(flashback table)

5).Data Pump(expdp、impdp)

相关学习推荐:oracle数据库学习教程

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
MySQL's Role: Databases in Web ApplicationsMySQL's Role: Databases in Web ApplicationsApr 17, 2025 am 12:23 AM

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

MySQL: Building Your First DatabaseMySQL: Building Your First DatabaseApr 17, 2025 am 12:22 AM

The steps to build a MySQL database include: 1. Create a database and table, 2. Insert data, and 3. Conduct queries. First, use the CREATEDATABASE and CREATETABLE statements to create the database and table, then use the INSERTINTO statement to insert the data, and finally use the SELECT statement to query the data.

MySQL: A Beginner-Friendly Approach to Data StorageMySQL: A Beginner-Friendly Approach to Data StorageApr 17, 2025 am 12:21 AM

MySQL is suitable for beginners because it is easy to use and powerful. 1.MySQL is a relational database, and uses SQL for CRUD operations. 2. It is simple to install and requires the root user password to be configured. 3. Use INSERT, UPDATE, DELETE, and SELECT to perform data operations. 4. ORDERBY, WHERE and JOIN can be used for complex queries. 5. Debugging requires checking the syntax and use EXPLAIN to analyze the query. 6. Optimization suggestions include using indexes, choosing the right data type and good programming habits.

Is MySQL Beginner-Friendly? Assessing the Learning CurveIs MySQL Beginner-Friendly? Assessing the Learning CurveApr 17, 2025 am 12:19 AM

MySQL is suitable for beginners because: 1) easy to install and configure, 2) rich learning resources, 3) intuitive SQL syntax, 4) powerful tool support. Nevertheless, beginners need to overcome challenges such as database design, query optimization, security management, and data backup.

Is SQL a Programming Language? Clarifying the TerminologyIs SQL a Programming Language? Clarifying the TerminologyApr 17, 2025 am 12:17 AM

Yes,SQLisaprogramminglanguagespecializedfordatamanagement.1)It'sdeclarative,focusingonwhattoachieveratherthanhow.2)SQLisessentialforquerying,inserting,updating,anddeletingdatainrelationaldatabases.3)Whileuser-friendly,itrequiresoptimizationtoavoidper

Explain the ACID properties (Atomicity, Consistency, Isolation, Durability).Explain the ACID properties (Atomicity, Consistency, Isolation, Durability).Apr 16, 2025 am 12:20 AM

ACID attributes include atomicity, consistency, isolation and durability, and are the cornerstone of database design. 1. Atomicity ensures that the transaction is either completely successful or completely failed. 2. Consistency ensures that the database remains consistent before and after a transaction. 3. Isolation ensures that transactions do not interfere with each other. 4. Persistence ensures that data is permanently saved after transaction submission.

MySQL: Database Management System vs. Programming LanguageMySQL: Database Management System vs. Programming LanguageApr 16, 2025 am 12:19 AM

MySQL is not only a database management system (DBMS) but also closely related to programming languages. 1) As a DBMS, MySQL is used to store, organize and retrieve data, and optimizing indexes can improve query performance. 2) Combining SQL with programming languages, embedded in Python, using ORM tools such as SQLAlchemy can simplify operations. 3) Performance optimization includes indexing, querying, caching, library and table division and transaction management.

MySQL: Managing Data with SQL CommandsMySQL: Managing Data with SQL CommandsApr 16, 2025 am 12:19 AM

MySQL uses SQL commands to manage data. 1. Basic commands include SELECT, INSERT, UPDATE and DELETE. 2. Advanced usage involves JOIN, subquery and aggregate functions. 3. Common errors include syntax, logic and performance issues. 4. Optimization tips include using indexes, avoiding SELECT* and using LIMIT.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function