Vous êtes sur la page 1sur 16

*********************Oracle Installation************************

1.Explain the steps of installing oracle 10g on a linux machine

Refer to the installation guide in class notes

2.What is the purpose of adding oinstall and dba groups?

oinstall to provide the user to install any oracle software

dba allows to administer the database

Is it compulsory that we need to give group names as oinstall and dba? Or can we give any other name?

We can give any name, but those are oracle standards

3.What are kernel parameters and why to set them?

They will define the memory allocation from physical memory to Oracle database

4.What is the difference in installing 10g and 11g on linux?

11g allows to set kernel parameter later whereas in 10g we need to do it before

5.What is Oracle inventory?

It is a location which provides the oracle product information which are installed on a particular host

6.Why to run orainstRoot.sh and root.sh scripts at the end of installation?

orainstRoot.sh will change the permissions for oraInventory and root.sh will create oratab file

7.When I am trying SQLPLUS, its throwing command not found error. How you will handle it?

We need to set oracle bin directory in PATH environment variable

8.Where you will set environment variables in linux? Why to set them?

We need to set in .bash_profile file. Setting them will help in easy access to commands

9.How you will set environment variables in windows?

We can set in advanced tab in mycomputer properties

10.When trying to connect to the database, I am getting net service name is incorrectly specified
error. What is the reason?

ORACLE_SID is not set


11.How to check how many databases are up and running at OS level?

ps ef | grep smon. Even though this is the generic command that is used, this is not the perfect answer
as it will give output even if instance is started. So the correct answer would be ps ef | grep oracle. In
the output, we need to see for processes which says LOCAL=NO which means someone connected to
the database from remote machine

12.How to check the version and bit version of oracle software?

SQL> select * from v$version;

13.How to check how many databases are existing on the server?

Using oratab file. But this may not give perfect answer if manually created databases are not updated

14.How many databases can we create on a single server?

Unlimited until cpu and memory configuration are supported

15.How many databases are there in your environment and categorize them?

Tell any value between 70 to 100. Out of that say 35 are prod and rest are dev and test

16.What is the highest size of the databases you are maintaining?

Tell any value between 400 to 700 GB

17.How many servers are there in your project? Which platforms you are comfortable to work in?

Tell any value between 30 to 50. Platforms are all unix and windows flavours

18.Can we change the block size after database creation?

No, we cannot

19.What are the 3 important steps after database created manually?

Executing catalog.sql script

Updating oratab file

Executing catproc.sql script

20.How to see background process at DB level?

SQL> select program from v$session;

21.How to start the database if pfile is not in default location?

SQL> startup pfile=location of pfile


22.I am creating a database manually and while executing script, I am getting ORACLE INSTANCE
TERMINATED, DISCONNECTION FORCED error. What went wrong and how you will troubleshoot?

This is due to UNDO tablespace name mismatch between create database script and pfile. Once fixed,
problem will be resolved

23.What is the difference between ORACLE_BASE and ORACLE_HOME?

ORACLE_BASE is the location where we can install oracle software and ORACLE_HOME is the database
home location

How to automate database startup during linux bootupbshut and dbstart scripts

25.What is your strategy to delete old traces?

We will delete them every 3 months except alert log. We will take backup of alertlog and will trim the
file

26.How to check RAM size at OS level?

We can user free or top command

27.How to check the size of a single directory?

du sk*

It is used to know the IO and memory statistics

28.While starting the database, I am getting END OF FILE ON COMMUNICATION CHANNEL error. You
are the only user connected to the database. What could be the reason for this?

If a particular mount point is full, in that case we will get that error

29.What are different types of SCN available?

We have TOP, START, STOP, BLOCK SCN etc

30.How many types of checkpoints are there?

We have nearly 10 checkpoints which helps in making data permanent in different stages of transaction

31.What is the use of oratab file?

To identify how many databases existing on a server

32.How do you check if oracle installed on a server?

By checking orainventory location


33.If I have 5 databases on a server, how to find which version they are?

By checking oratab file

**CLONING**

1. Take the backup of source database including pfile/spfile and password file.

*backup database plus archivelog;

2. Transfer the backup pieces to target database.

*scp backup pieces oracle@target_db:location(target)

3. copy the pfile and password files to $ORACLE_HOME/dbs (target)

4. Create the directories if required.

5. Put the target database in nomount mode.

6. connect to rman

7. restore the control file

*restore controlfile from backup;

8. put the database in mount state

9. restore the database. (catalog the backup pieces)

*restore database;

10. copy the archive logs from source to target.

*scp archivelogs oracle@target_db:location (target db)

11. recover the database ( catalog the archive log location)==============>

*recover database;

12. alter database open resetlogs.


**************Creating Physical Database*********************

1.Check if the primary database is using the password file or not. If not, then create one

2.Add the following parameters in the initialization parameter file of the primary database

prim.__db_cache_size=46137344

prim.__java_pool_size=4194304

prim.__large_pool_size=4194304

prim.__oracle_base='/u01/home/oracle'#ORACLE_BASE set from environment

prim.__pga_aggregate_target=205520896

prim.__sga_target=239075328

prim.__shared_io_pool_size=0

prim.__shared_pool_size=167772160

prim.__streams_pool_size=8388608

*.audit_file_dest='/u01/home/oracle/admin/prim/adump'

*.audit_trail='db'

*.compatible='11.2.0.0.0'

*.control_files='/u01/app/oracle/oradata/prim/control01.ctl','/u01/app/oracle/oradata/prim/control02.
ctl'

*.db_block_size=8192

*.db_domain=''

*.db_name='prim'

*.diagnostic_dest='/u01/home/oracle'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=primXDB)'

*.db_recovery_file_dest='/u01/app/fra'

*.db_recovery_file_dest_size=2070572032 #(I have it as nearly 2 GB)

*.memory_target=444596224

*.open_cursors=300
*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.undo_tablespace='UNDOTBS1'

*.db_unique_name='prim'

*.log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=prim'

*.log_archive_dest_2='service=stnd valid_for=(ONLINE_LOGFILES,primARY_ROLE)
DB_UNIQUE_NAME=stnd'

*.log_archive_dest_state_1=enable

*.log_archive_dest_state_2=enable

3.Setup the connectivity (listener.ora and tnsnames.ora) for the primary and standby databases.

4.Add the following parameters in the initialization parameter file of the standby database

stnd.__db_cache_size=230686720

stnd.__java_pool_size=4194304

stnd.__large_pool_size=4194304

stnd.__pga_aggregate_target=268435456

stnd.__sga_target=394264576

stnd.__shared_io_pool_size=0

stnd.__shared_pool_size=146800640

stnd.__streams_pool_size=0

*.audit_file_dest='/u01/app/oracle/admin/stnd/adump'

# *.audit_trail='db'

*.compatible='11.2.0.0.0'

*.control_files='/u02/app/oracle/oradata/stnd/control01.ctl','/u02/app/oracle/oradata/stnd/control02.
ctl'

*.db_block_size=8192
*.db_domain=''

*.db_name='prim'

*.db_recovery_file_dest='/u01/app/fra'

*.db_recovery_file_dest_size=2070572032

*.diagnostic_dest='/u01/app/oracle'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=stndXDB)'

*.log_archive_format='%t_%s_%r.dbf'

*.memory_target=660602880

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.undo_tablespace='UNDOTBS1'

*.log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles)
db_unique_name=stnd'

*.log_archive_dest_2='service=prim valid_for=(online_logfiles,primary_role) db_unique_name=prim'

*.db_unique_name='stnd'

*.db_file_name_convert='/u01/app/oracle/oradata/prim/','/u02/app/oracle/oradata/stnd/'

*.log_file_name_convert='/u01/app/oracle/oradata/prim/','/u02/app/oracle/oradata/stnd/'

*.standby_file_management=AUTO

*.FAL_SERVER='prim'

*.FAL_CLIENT='stnd'

*.log_archive_dest_state_1=enable

*.log_archive_dest_state_2=defer

5. Now copy the password file of the primary database orapwprim located at $ORACLE_HOME/dbs to
the standby server location $ORACLE_HOME/dbs and rename the file as orapwstnd
6. Now connect to the primary database as target database and standby database as auxiliary instance
through RMAN. Make sure that the primary database is open and the standby database is in nomount
stage (STARTED).

*rman target sys/<password>@prim auxiliary sys/<password>@stnd

7.Now perform the duplicate operation to create the standby database

*rman>duplicate target database for standby from active database nofilenamecheck;

8. Once the duplication is completed, close the RMAN prompt and connect to the standby database
through SQL

*sqlplus sys/<password>@stnd as sysdba

9.sqlplus sys/<password>@stnd as sysdba

*sql>

10.Now start the managed recovery process on the standby database

*sql>alter database recover managed standby database disconnect from session;

11.Now check if the managed recovery process (MRP) has been started on the standby database or not

*sql>select process,status,sequence# from v$managed_standby;

12.On the primary database, perform a few log switches and check if the logs are applied to the standby
database

*SQL> select max(sequence#) from v$archived_log;

*SQL> select thread#,max(sequence#) from v$archived_log where applied='YES' group by thread#;

log_archive_dest_2=/u01/app/oracle/dest/redo VALID=FOR(ONLINE_LOGS,PRIMARY_ROLE)

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE;(To start
real-time apply, include the USING CURRENT LOGFILE)

SQL> SELECT RECOVERY_MODE FROM V$ARCHIVE_DEST_STATUS;

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;(To stop Redo Apply)

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DELAY 60DISCONNECT;

****ORA-01665: control file is not a standby control file**


startup nomount;

ALTER DATABASE CONVERT TO PHYSICAL STANDBY;

SQL> STARTUP MOUNT;

**************RMAN********************

1.What is RMAN?

Recovery Manager (RMAN) is a utility that can manage your entire Oracle backup and recovery
activities.

2.What is the difference between using recovery catalog and control file?

When new incarnation happens, the old backup information in control file will be lost. It will be
preserved in recovery catalog.

In recovery catalog we can store scripts.

Recovery catalog is central and can have information of many databases.

3.Can we use same target database as catalog?

No, The recovery catalog should not reside in the target database (database should be backed up),
because the database cant be recovered in the mounted state.

4.How do you know that how much RMAN task has been completed?

By querying v$rman_status or v$session_longops

5.From where list & report commands will get input?

Both the commands command quering v$ and recovery catalog views. V$BACKUP_FILES or many of the
recovery catalog views such asRC_DATAFILE_COPY or RC_ARCHIVED_LOG.

6.Command to delete archive logs older than 7days?

RMAN> delete archivelog all completed before sysdate-7;


7.How many times does oracle ask before dropping a catalog?

The default is two times one for the actual command, the other for confirmation.

How to view the current defaults for the database.

RMAN> show all;

8.What is the use of crosscheck command in RMAN?

Crosscheck will be useful to check whether the catalog information is intact with OS level information.

This command only updates repository records with the status of the backups.

e.g. If user removes archived logs from disk with an operating system command, the repository still
indicates that the logs are on disk, when in fact they are not.

9.What are the differences between crosscheck and validate commands?

Validate command is to examine a backup set and report whether it can be restored.

RMAN scans all of the backup pieces in the specified backup sets and looks at the checksum to verify
that the contents are intact so that backup can be successfully restored if necessary.

Crosscheck command is to verify the status of backups and copies recorded in the RMAN repository
against media such as disk or tape. The crosscheck command only processes files created on the same
device type as the channel running crosscheck.

10.Which one is good, differential (incremental) backup or cumulative (incremental) backup?

A differential backup, which backs up all blocks changed after the most recent incremental backup at
level 1 or 0

RMAN> BACKUP INCREMENTAL LEVEL 1 DATABASE;

A cumulative backup, which backs up all blocks changed after the most recent incremental backup at
level 0

RMAN> BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;

Cumulative backups are preferable to differential backups when recovery time is more important than
disk space, because during recovery each differential backup must be applied in succession. Use
cumulative incremental backups instead of differential, if enough disk space is available to store
cumulative incremental backups.
This is command for taking Level 0 backup.

RMAN> BACKUP INCREMENTAL LEVEL 0 DATABASE;

11.What is the difference between backup set and backup piece?

Backup set is logical and backup piece is physical.

RMAN command to backup for creating standby database

RMAN> duplicate target database

12.You loss one datafile and DB is running in ARCHIVELOG mode. You have full database backup of 1
week/day old and dont have backup of this (newly created) datafile. How do you restore/recover file?

Create data file and recover datafile.

SQL> alter database create datafile /u01/app/oracle/oradata/xyz.dbf size 2G;

RMAN> recover datafile file_id;

13.What is obsolete backup & expired backup?

A status of expired means that the backup piece or backup set is not found in the backup destination.

A status of obsolete means the backup piece is still available, but it is no longer needed. The backup
piece is no longer needed since RMAN has been configured to no longer need this piece after so many
days have elapsed, or so many backups have been performed RMAN's retention configuration
determines when a backup piece becomes obsolete.

14.What is the difference between hot backup & RMAN backup?

For hot backup, we have to put database in begin backup mode, then take backup.

RMAN wont put database in backup mode.

15.How to put manual/user-managed backup in RMAN (recovery catalog)?

By using catalog command.

RMAN> CATALOG START WITH /tmp/backup.ctl;

16.What are the Architectural components of RMAN?

RMAN Executables

Sercer process

Channels
Target database

Recovery catalog database (optional)

Media management Layer (optional)

Backups, backup sets and backup pieces

17.What are channels?

A channel is an RMAN server process started when there is a need to communicate with an I/O device,
such as a disk or a tape. A channel is what reads and writes RMAN backup files. It is through the
allocation of channels that you govern I/O characteristics:

Type of I/O device being read or written to, either a disk or an sbt_tape

Number of processes simultaneously accessing an I/O device

Maximize size of files created on I/O devices

Maximize rate at which database files are read

Maximize number of files open at a time

18.Why is the catalog optional?

Because RMAN manages backup and recovery operations, it requires a place to store necessary
information about the database. RMAN always stores this information in the target database control
file. You can also store RMAN metadata in a recovery catalog schema contained in a separate database.
The recovery catalog schema must be stored in a database other than the target database.

19.What is a Backup set?

A logical grouping of backup files the backup pieces that are created when you issue an RMAN
backup command. A backup set is RMANs name for a collection of files associated with a backup. A
backup set is composed of one or more backup pieces.

20.What are the benefits of using RMAN?

Incremental backups that only copy data blocks that have changed since the last backup.

Tablespaces are not put in backup mode, thus there is noextra redo log generation during online
backups.

Detection of corrupt blocks during backups.

Parallelization of I/O operations.

Automatic logging of all backup and recovery operations.


Built-in reporting and listing commands.

What are the various reports available with RMAN

RMAN>list backup;

RMAN> list archive;

21.In catalog database, if some of the blocks are corrupted due to system crash, How will you recover?

using RMAN BLOCK RECOVER command

22.How do you enable the autobackup for the controlfile using RMAN?

Issue command at RMAN prompt.

RMAN> configure controlfile autobackup on;

Also we can configure controlfile backup format.

RMAN> configure controlfile autobackup format for device type disk to

2> $HOME/BACKUP/RMAN/ F.bkp;

23.How do you identify what are the all the target databases that are being backed-up with RMAN
database?

You dont have any view to identify whether it is backed up or not. The only option is connect to the
target database and give list backup this will give you the backup information with date and timing.

24.How do you identify the block corruption in RMAN database? How do you fix it?

Using v$block_corruption view you can find which blocks corrupted.

RMAN> block recover datafile <fileid> block <blockid>;

Using the above statement You recover the corrupted blocks. First check whether the block is corrupted
or not by using this command

SQL>select file# block# from v$database_block_corruption;

file# block

2 507

the above block is corrupted

conn to Rman
To recover the block use this command

RMAN>blockrecover datafile 2 block 507;

the above command recover the block 507

Now just verify it..

Rman>blockrecover corruption list;

25.How do you clone the database using RMAN software? Give brief steps? When do you use crosscheck
command?

Check whether backup pieces proxy copies or disk copies still exist.

Two commands available in RMAN to clone database:

1) Duplicate

2) Restore.

26.List some of the RMAN catalog view names which contain the catalog information?

RC_DATABASE_INCARNATION RC_BACKUP_COPY_DETAILS

RC_BACKUP_CORRUPTION

RC_BACKUP-DATAFILE_SUMMARY

27.How do you install the RMAN recovery catalog?

Steps to be followed:

1) Create connection string at catalog database.

2) At catalog database create one new user or use existing user and give that user a
recovery_catalog_owner privilege.

3) Login into RMAN with connection string

a) export ORACLE_SID

b) rman target catalog @connection string

4) rman> create catalog;

5) register database;
28.What is the difference between physical and logical backups?

In Oracle Logical Backup is which is taken using either Traditional Export/Import or Latest Data Pump.
Where as Physical backup is known when you take Physical O/s Database related Files as Backup.

29.What is RAID? What is RAID0? What is RAID1? What is RAID 10?

RAID: It is a redundant array of independent disk

RAID0: Concatenation and stripping

RAID1: Mirroring

30.How to enable Fast Incremental Backup to backup only those data blocks that have changed?

SQL> ALTER DATABASE enable BLOCK CHANGE TRACKING;

31.How do you set the flash recovery area?

SQL> ALTER SYSTEM SET db_recovery_file_dest_size = 100G;

SQL> ALTER SYSTEM SET db_recovery_file_dest = /u10/oradata/school;

32.What is auxiliary channel in RMAN? When do you need this?

An auxiliary channel is a link to auxiliary instance. If you do not have automatic channels configured,
then before issuing the DUPLICATE command, manually allocate at least one auxiliary channel within the
same RUN command.

33.How do you use the V$RECOVERY_FILE_DEST view to display information regarding the flashrecovery
area?

SQL> SELECT name, space_limit, space_used,space_reclaimable, number_of_filesFROM


v$recovery_file_dest;

34.How can you display warning messages?

SQL> SELECT object_type, message_type,message_level, reason, suggested_actionFROM


dba_outstanding_alerts;

35.How do you backup the entire database?

RMAN> BACKUP DATABASE;

36.How do you backup an individual tablespaces?

RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK;


RMAN> BACKUP TABLESPACE system;

37.How do you backup datafiles and control files?

RMAN> BACKUP DATAFILE 3;

RMAN> BACKUP CURRENT CONTROLFILE;

Use a fast recovery without restoring all backups from their backup location to the location specified
inthe controlfile.

RMAN> SWITCH DATABASE TO COPY;

RMAN considers backups of datafiles and control files as obsolete, that is, no longer needed for
recovery, according to criteria that we specify in the CONFIGURE command. We can then use the
REPORT OBSOLETE command to view obsolete files and DELETE OBSOLETE to delete them .

For ex : we set our retention policy to redundancy 2. this means we always want to keep at least 2
backup, after 2 backup, if we take an another backup oldest one become obsolete because there is 3
backup and we want to keep 2. if our flash recovery area is full then obsolete backups can be overwrite.

A status of "expired" means that the backup piece or backup set is not found in the backup destination
or missing .Since backup info is hold in our controlfile and catalog . Our controlfile thinks that there is a
backup under a directory with a name but someone delete this file from operating system. We can run
crosscheck command to check if these files are exist and if rman found a file is missing then mark that
backup record as expired which means is no more exists.

Vous aimerez peut-être aussi