I. multiple choice questions
1. When you execute the following query statement:
Select empno, ename
From EMP
Where empno = 7782 or empno = 7876;
In the where statement, which of the following operators can replace or?
A. In
B. ...... And
C. Like
D. <=
E.> =
2. Which of the following is the implementation of IF... then... Else logic?
A. initcap ()
B. Replace ()
C. Decode ()
D. ifelse ()
3. Which of the following lines is wrong?
1 select deptno
2 from EMP
3 group by deptno
4 having count (deptno) =
5 (select max (count (deptno ))
6 from EMP
7 group by deptno );
A. Line 3
B. Line 4
C. Line 5
D. Line 7
E. That's all right.
4. When a program executes the Select... for update statement, which of the following steps must be completed?
A. Execute commit or rollback to end transaction, even if no data changes.
B. If data changes, run commit or rollback to end transaction.
C. Since a transaction starts only after the data changes, you do not need to execute commit or rollback.
5. Which of the following commands can be used to drop the update_dt column from the table state?
A. alter table state drop column update_dt;
B. ALTER TABLE State remove column update_dt;
C. Drop column update_dt from State;
D. You cannot drop this column from this table.
6. Which command is used to create a primary key constraint?
Pk_books is on the books table and the ISBN column? Select one.
A. Create primary key on books (ISBN );
B. Create constraint pk_books primary key on books (ISBN );
C. alter table books add constraint pk_books primary key (ISBN );
D. alter table books add primary key (ISBN );
7. Which of the following lines is wrong?
1 x: = Y + 200;
2 If x <10 then
3 Y: = 30;
4 elseif x <40 then
5 Y: = 20;
6 end if;
A. Line 2
B. Line 3
C. Line 4
D. Line 5
8. A view is created by the following statement. Which operation can be performed on this view?
Create view usa_states
As select * from state
Where cnt_code = 1
With read only;
A. Select
B. Select, update
C. Select, delete
D. Select, insert
Ii. Q &
1. Briefly describe the steps for installing oracle on the UNIX platform;
2. What are the Oracle startup methods?
1. startup nomount
Non-installation startup. In this mode, you can execute: re-build the control file and re-build the database.
Read the init. ora file and start the instance, that is, start the SGA and background processes. To start the process, you only need the init. ora file.
2. startup Mount dbname
Install and start. In this mode, run:
Database Log archiving,
Database media recovery,
Online or offline data files,
Locate the data file and redo the log file.
Execute "nomount", open the control file, and confirm the location of the data file and the on-line log file,
However, data files and log files are not verified at this time.
3. startup open dbname
Run "nomount" first, then "Mount", and then open all database files including the redo log file,
In this way, you can access data in the database.
4. startup, which is equal to the following three commands
Startup nomount
Alter database Mount
Alter database open
5. startup restrict
Constraint-based startup
This method can start the database, but only allows users with certain privileges to access
When a non-authorized user accesses the service, the following prompt is displayed:
Error:
ORA-01035: Oracle only applies to users with restricted session Permissions
6. startup force
Force start Mode
When the database cannot be closed, you can use startup force to close the database.
Shut down the database first, and then execute the normal database startup command
7. startup pfile = parameter file name
Startup method with initialization parameter file
Read the parameter file first, and then start the database according to the settings in the parameter file.
Example: startup pfile = E: oracleadminoradbpfileinit. ora
8. startup exclusive
3. What is the role of controlling files in Oracle?
In the Oracle database, the control file records the physical structure of the database and the value of transaction control (SCN, checkpoint, etc.), as well as some information that can be rewritten (such as backup metadata ). control files must be used during instance recovery and media recovery. You also need to archive logs.
File.
4. Briefly describe the composition of SGA;
SGA (system global area) is a basic component of Oracle instance.
Dynamic Allocation. Is a group of shared memory structures that contain data and control information of an Oracle instance. The memory zone used to store database information. This information is shared by database processes (PGA cannot be shared ). It contains data and control information of the Oracle server. It is allocated in the actual memory of the computer where the Oracle server resides. If the actual memory is insufficient, it can be written to the virtual memory.
It mainly includes:
1. The database buffer cache ),
2. Repeat the log cache (the redo log buffer)
3. The Shared Pool)
4. The data dictionary cache and other information.
5. What types of database tablespaces are generally divided? What are the approximate functions of each category?
Tablespaces have the following types:
System catalog tablespace (syscatspace)
System temporary tablespace (systempspace)
User tablespace)
User temporary tablespace (usertempspace)
A database must have two basic system tablespaces: The system catalog tablespace and the system temporary tablespace.
Tablespace. Any object created in the database is reflected by adding a record to the system catalog tablespace,
The disk size occupied by temporary tablespace is dynamically scaled according to usage, that is, it is allocated only when necessary.
Disk space and reclaim it after use. In addition, if you want to create a table, you need to create a user tablespace,
To use a temporary table, you must create a temporary table space.
6. How do I configure a connection string to access the remote database?
1 Assume that the remote connection string is '192. 111.123.321: 210: emp ';
2 test if connection is successful connect Scott/[email protected]: 1521: EMP
3. Connect to the local database and run the following command:
Create database link remote_db connect to Scott identified by tiger using 'remote ';
4 DML Test
Select count (*) from EMP @ remote_db
7. Which process must be started on the server to access the remote database for network listening?
LSNRCTL
8. What are the standard backup methods for Oracle databases?
1. Export/Import (exp/IMP ).
2. Hot Backup.
3. Cold backup.
Note: Exporting spare parts is a logical backup, while cold backup and hot backup are physical backup.
1. Export/import (export/import)
The export can be used to extract data from the database, and the import can be used to send the extracted data back to the Oracle database.
1. Simple export of data (export) and import of data (import)
Oracle supports three types of output:
(1) Export the data of the specified table in the T mode.
(2) user mode (U mode), which exports all objects and data of the specified user.
(3) full database mode (full mode). All objects in the databases are exported.
The data import process is the inverse process of data export (export). The data files are imported into the database and the database data is exported to the data file respectively.
2. incremental Export/Import
Incremental export is a common data backup method. It can only be implemented for the entire database and must be exported as a system. The default export file name is export. dmp. If you do not want your output file to be named export. DMP, you must specify the file name to use in the command line.
Incremental export includes three types:
(1) Complete incremental Export (complete)
Three databases are backed up, for example:
Exp system/manager inctype = complete file = 040731.dmp
(2) incremental Export
Back up the data changed after the last backup, for example:
Exp system/manager inctype = incremental file = 040731.dmp
(3) "accumulative" incremental Export
The accumulative export mode is used to export the changed information in the database after the last "full" export. For example:
Exp system/manager inctype = cumulative file = 040731.dmp
The database administrator can schedule a backup schedule and export data in three different ways.
For example, you can make the following arrangements for database blocking tasks:
Monday: Full backup ()
Tuesday: Incremental Export (B)
Wednesday: Incremental Export (c)
Thursday: Incremental Export (d)
Friday: accumulative Export (E)
Saturday: Incremental Export (f)
Sunday: Incremental Export (g)
If the database is accidentally damaged on Sunday, the database administrator can follow these steps to reply to the database:
Step 1: Use the create database Command to regenerate the database structure;
Step 2: create a large enough additional rollback.
Step 3: import a in full Increments:
IMP system/manager inctype = restore full = y file =
Step 4: Accumulative incremental import E:
IMP system/manager inctype = restore full = y file = E
Step 5: import the latest incremental F:
IMP system/manager inctype = restore full = y file = f
Ii. Cold backup
Cold backup occurs when the database is shut down normally. When the database is shut down normally, it will provide us with a complete database. This article describes how to copy key files to another location during cold backup. The fastest and safest way to back up Oracle information during cold backup. Advantages of cold backup:
1. It is a very fast backup method (just copy files)
2. Easy to archive (simple copy)
3. easy recovery to a certain point in time (you only need to copy the file back.
4. It can be combined with the archiving method to restore the database in the "best state.
5. Low maintenance and high security.
However, cold backup also has the following shortcomings:
1. When used separately, only recovery at a certain time point can be provided.
2. During the whole backup process, the database must be backed up instead of other work. That is to say, in the cold backup process, the database must be closed.
3. If the disk space is limited, it can only be copied to tape and other external storage devices, and the speed will be very slow.
4. data cannot be restored by table or by user.
If possible (mainly for efficiency), back up the information to the disk, start the database (allowing the user to work), and copy the backup information to the tape, the database can also work ). Files that must be copied in cold backup include:
1. All data files
2. All control files
3. All online redo log files
4. init. ora file (optional)
It is worth noting that cold backup must be performed when the database is closed. When the database is turned on, the execution of database file system backup is invalid.
The following is a complete example of cold backup.
(1) shut down the database
Sqlplus/nolog
SQL> connect/As sysdba
SQL> shutdown normal;
(2) Use the Copy command to back up all the time files, redo log files, control files, and initialize parameter files.
SQL> CP <File> <Backup directory>
(3) restart the Oracle database
SQL> startup
Iii. Hot Backup
Hot Backup is used to back up the database in archivelog mode when the database is running. Therefore, if you have a cold backup file last night and a hot backup file today, you can use this data to restore more information when a problem occurs. Hot Backup requires that the database be operated in archivelog mode and requires a large amount of archive space. Once the database is running in the archivelog state, you can back up the database. The Hot Backup command file consists of three parts:
1. Backup of one tablespace and one tablespace in a data file.
(1) set the tablespace to the backup state.
(2) back up the data files in the tablespace
(3) restore the tablespace to the normal state.
2. Back up archive log files
(1) temporarily stop the archiving process
(2) files in the archive Rede log target directory under Log
(3) restart the archive Process
(4) back up the archived redo log file
3. Use the alter database bachup controlfile command to back up control files
Advantages of Hot Backup:
1. Data can be backed up at the tablespace or database file level. The backup time is short.
2. The database is still available during Backup.
3. It can be restored in seconds (to a specific point in time ).
4. Restore almost all database entities
5. Recovery is fast. In most cases, apsaradb recovers when it is still working.
Hot Backup defects:
1. Do not make mistakes; otherwise, the consequences will be disastrous.
2. If the Hot Backup fails, the result cannot be used for restoration at a time point.
3. Because it is difficult to maintain, you need to be careful and cannot cancel the operation halfway.