Pages
Saturday, November 14, 2020
Script To Schedule RMAN Backups In Crontab
Different Ways To Check The Tablespaces Size
Different Ways To Check The Tablespace Size
Script 1.
set linesize 100 pages 100 trimspool on numwidth 14
col name format a25
col owner format a15
col "Used (GB)" format a15
col "Free (GB)" format a15
col "(Used) %" format a15
col "Size (M)" format a15
SELECT d.status "Status", d.tablespace_name "Name", TO_CHAR(NVL(a.bytes / 1024 / 1024 /1024, 0),'99,999,990.90') "Size (GB)", TO_CHAR(NVL(a.bytes - NVL(f.bytes, 0), 0)/1024/1024 /1024,'99999999.99') "Used (GB)", TO_CHAR(NVL(f.bytes / 1024 / 1024 /1024, 0),'99,999,990.90') "Free (GB)", TO_CHAR(NVL((a.bytes - NVL(f.bytes, 0)) / a.bytes * 100, 0), '990.00') "(Used) %" FROM sys.dba_tablespaces d, (select tablespace_name, sum(bytes) bytes from dba_data_files group by tablespace_name) a, (select tablespace_name, sum(bytes) bytes from dba_free_space group by tablespace_name) f WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = f.tablespace_name(+) AND NOT (d.extent_management like 'LOCAL' AND d.contents like 'TEMPORARY') UNION ALL SELECT d.status "Status", d.tablespace_name "Name", TO_CHAR(NVL(a.bytes / 1024 / 1024 /1024, 0),'99,999,990.90') "Size (GB)", TO_CHAR(NVL(t.bytes,0)/1024/1024 /1024,'99999999.99') "Used (GB)", TO_CHAR(NVL((a.bytes -NVL(t.bytes, 0)) / 1024 / 1024 /1024, 0),'99,999,990.90') "Free (GB)",TO_CHAR(NVL(t.bytes / a.bytes * 100, 0), '990.00') "(Used) %" FROM sys.dba_tablespaces d, (select tablespace_name, sum(bytes) bytes from dba_temp_files group by tablespace_name) a, (select tablespace_name, sum(bytes_cached) bytes from v$temp_extent_pool group by tablespace_name) t WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = t.tablespace_name(+) AND d.extent_management like 'LOCAL' AND d.contents like 'TEMPORARY';
Script 2.
column TABLESPACE_NAME for a20
column FILE_NAME for a93
set lines 220 pages 220
Script 3.
select fs.tablespace_name "Tablespace", (df.totalspace - fs.freespace) "Used MB", fs.freespace "Free MB", df.totalspace "Total MB", round(100 * (fs.freespace / df.totalspace)) "Pct. Free" from (select tablespace_name, round(sum(bytes) / 1048576) TotalSpace from dba_data_files group by tablespace_name ) df, (select tablespace_name, round(sum(bytes) / 1048576) FreeSpace from dba_free_space group by tablespace_name ) fs where df.tablespace_name = fs.tablespace_name order by 1;
Script 4.
set lin 120
set echo off
set feed off
column PCT format 999.99
column tbspce format A30
col container for a30
select substr(f.tablespace_name,1,30) tbspce, round(f.tsbytes/(1024*1024),0) "ALLOCATED(MB)", round(nvl(s.segbytes,0)/(1024*1024),0) "USED(MB)", round((nvl(s.segbytes,0)/f.tsbytes)*100,2) PCT, lower(vc.name) as container from (select con_id,tablespace_name,sum(bytes) tsbytes from cdb_data_files group by con_id,tablespace_name) f, (select con_id,tablespace_name,sum(bytes) segbytes from cdb_segments group by con_id,tablespace_name) s, v$containers vc where f.con_id=s.con_id(+) and f.tablespace_name=s.tablespace_name(+) and f.con_id=vc.con_id order by container, tbspce;
Script 5.
set pages 999
set lines 400
SELECT df.tablespace_name tablespace_name, max(df.autoextensible) auto_ext, round(df.maxbytes / (1024 * 1024), 2) max_ts_size,round((df.bytes - sum(fs.bytes)) / (df.maxbytes) * 100, 2) max_ts_pct_used,round(df.bytes / (1024 * 1024), 2) curr_ts_size,round((df.bytes - sum(fs.bytes)) / (1024 * 1024), 2) used_ts_size,round((df.bytes-sum(fs.bytes)) * 100 / df.bytes, 2) ts_pct_used,round(sum(fs.bytes) / (1024 * 1024), 2) free_ts_size, nvl(round(sum(fs.bytes) * 100 / df.bytes), 2) ts_pct_free FROM dba_free_space fs, (select tablespace_name, sum(bytes) bytes, sum(decode(maxbytes, 0, bytes, maxbytes)) maxbytes, max(autoextensible) autoextensible from dba_data_files group by tablespace_name) df WHERE fs.tablespace_name (+) = df.tablespace_name GROUP BY df.tablespace_name, df.bytes, df.maxbytes UNION ALL SELECT df.tablespace_name tablespace_name, max(df.autoextensible) auto_ext, round(df.maxbytes / (1024 * 1024), 2) max_ts_size, round((df.bytes - sum(fs.bytes)) / (df.maxbytes) * 100, 2) max_ts_pct_used, round(df.bytes / (1024 * 1024), 2) curr_ts_size, round((df.bytes - sum(fs.bytes)) / (1024 * 1024), 2) used_ts_size, round((df.bytes-sum(fs.bytes)) * 100 / df.bytes, 2) ts_pct_used, round(sum(fs.bytes) / (1024 * 1024), 2) free_ts_size, nvl(round(sum(fs.bytes) * 100 / df.bytes), 2) ts_pct_free FROM (select tablespace_name, bytes_used bytes from V$temp_space_header group by tablespace_name, bytes_free, bytes_used) fs, (select tablespace_name, sum(bytes) bytes, sum(decode(maxbytes, 0, bytes, maxbytes)) maxbytes, max(autoextensible) autoextensible from dba_temp_files group by tablespace_name) df WHERE fs.tablespace_name (+) = df.tablespace_name GROUP BY df.tablespace_name, df.bytes, df.maxbytes ORDER BY 4 DESC;
Oracle Rac Interview Questions
Oracle Rac Interview Questions
- How end-user can connect to the RAC Database?
- What is a Voting Disk and why we keep an odd number of VD?
- What is a split-brain syndrome in RAC? If this issue is there for a longer time, then what happens??
- Explain high-level steps to install Oracle 3 node RAC database?
- Explain patching types in oracle RAC and steps to apply a patch?
- Can we use a different Operating system when configuring RAC?
- Clusterware fencing is available from which version?
- What are the two methods of Clusterware communication?
- How many nodes we can configure in RAC?
- Can you use IPv6 for Private IP?
- Differences between Single Instance Vs RAC?
- What files store in the Clusterware?
- What is the File system that certified for RAC?
- What protocol used in the oracle RAC interconnect network?
- What do you need to plan before migrating Single Instance to RAC?
- How many nodes we can configure in RAC?
- Can we use a different Operating system when configuring RAC?
- Clusterware fencing is available from which version?
- What is two methods for Clusterware communication?
- How Many IP needed for 2 node RAC according to Oracle best practices?
- What is Cache Fusion?
- What is GRD?
- What is the role of the Voting Disk?
- How to check resources in the cluster?
- How to check clusters are up ON all nodes?
- How to check the cluster is UP on a particular node?
- How to bring Down the one specific node in RAC?
- What will you check if the query is running slow?
- DIfference between Bitmap & B-tree Index?
- Tell me Wait Event in RAC?
- How many disks in ASM Normal Redundancy?
- How to create Data Guard?
- How to fix the gap in Data Guard?
- Difference between DBFile Sequential and Scattered Reads?
- What is Fragmentation in Oracle Database?
- Table Fragmentation in Oracle Database?
- How to recover Table in oracle database?
- Can we transfer the data between Linux to windows?
- Difference between b-tree and bitmap index?
- What is gc cr request in RAC?
- What is the Library cache lock? When it will occur?
- How you solve Library cache lock issues?
- Library cache Lock issues In AWR which section you will look in to?
- In Library cache lock how connection management call elapsed time will impact?
- One user fire select statement for the long table after that one user drop that table. then what will happen for a select query?
- Rolling Upgrade in Oracle RAC?
- How to Fix the log switches problem?
- Oracle Database “19c New Features”?
- How to check ASM status?
- Have you done ASM metadata backup?
- What is SQL BaseLine?
- What are the two source attributes for SQL Base Line?
- How to Create a SQL Base Line?
- In one Table Index is there but Optimizer is not using index what will be the reason?
- What are Deadlocks? How it will be resolved?
- One user A Started a Transaction after that user B started the transaction on the same row in that table. So Deadlock occurs. Which user Transaction will rollback? DBA will rollback or it happens automatically?
- What are the Locks? Tell me the name Object Type of Lock?
- If user Fire Select query Statement so Lock will happen or not?
- When the user fires the Select statement than in backend how it will execute?
- What is the SQL patch? Why did we use it?
Oracle Database Interview Questions
Oracle Database Interview Questions
- What is the section you will look into in the AWR Report to improve the DB performance?
- What is the basic parameter you will set for RMAN?
- What is the troubleshooting you did in your daily activities?
- Why we do CF Multiplexing?
- How you can replace Optimizer EP for your Query?
- How you will get the datafile block corruption information?
- For SQL Query Improvement what you will do?
- For SQL Query Problem what section you will look into?
- What is Bind Peeking Variable?
- What is Free Buffer Busy Wait?
- How to change the DB name?
- What are things you look into when you are creating a Test Environment from a Production Environment? (loading production data in a test environment)
- How to attach any parameters in the running job if you don’t know ENCRYPTION_PASSWORD?(my dump file has an encryption password)
- How to Attaching a parameter to a running Job?
- How to Identifying data pump jobs?
- How to Refresh Database from PROD to TEST?
- What are the types of Hints we can use for Optimizer?
- In the Oracle SQL execution plan what columns you will look into?
- How to read & understand the EP?
- Why do bind variables matter for performance?
- If your standby database is lagging relative to the primary database, you should focus on which areas?
- How You Determining transport or apply lag is done on the standby database?
- How you Find local time on the standby database when the datum used to compute the metric was received it means (the lag metrics are computed based on data that's periodically received from the primary database)?
- How you will Find out the history of apply lag values since the standby instance was last started?
- How to monitor and assess redo apply performance?
- What are the RECOVERY PROCESS WAIT EVENTS in Data Guard?
- Which Script creates the standby statspack schema to hold the standby snapshots?
- Which script generates the standby statistics report?
- Which script is used to purge a set of snapshots in the Data Guard?
- Which script drops the stdbyperf user and tables?
- Can A logical standby accept archived logs while a rolling upgrade is taking place?
- How to determine whether any tables involved in a rolling upgrade performed with the
- DBMS_ROLLING PL/SQL package contains unsupported data types?
- Can we transport of redo data to a Recovery Appliance?
- For rolling upgrades which Procedure Support?
- Can we rename the data file on the standby site when the STANDBY_FILE_MANAGEMENT initialization parameter is set to AUTO?
- If the standby site is not receiving redo data, Which view you will check for error messages?
- Can we mount the standby database if the standby control file was not created?
- If you specify REOPEN for a MANDATORY destination, and redo data is not transmitted then what will happen on Primary Database?
- Which tool(Procedure) you will use for handling logical standby database failures?
- If the switchover does not complete successfully, which view you will check?
- Can we move an online datafile in a data guard from one physical file to another physical file while the database is actively accessing the file?
- Can we create a physical standby of a Multitenant container database(CDB)?
- Can we use SYNC & NOAFFIRM ATTRIBUTES use together in maximum availability mode?
- Using CURRENT LOGFILE clause is required to start real-time apply in data guard?
- Can we do DML operations on global temporary tables on Oracle Active Data Guard standbys?
- Can we use sequences in an Oracle Active Data Guard environment?
- When you perform a switchover from an Oracle RAC primary database to a physical standby database, it is necessary to shut down all but one primary database instance?
- Can we use Application Continuity Feature for Oracle Data Guard switchovers to physical standby databases?
- Can we use Application Continuity Feature for fast-start failover to physical standbys in maximum availability data protection mode?
- Can we create a logical standby of a CDB?
- What is the prerequisite required for data pump export and Import?
- If performance is slow in the Data pump, what will you do?
- How you will monitor the Data pump activity?
- What are the migration's high-level steps in Azure?
- What are the factors DBA should look into Migration?
- We are using RMAN backup for migration but it is taking too much time and we have 4 hrs window to migrate, What will be your approach and Will data guard be beneficial for this problem?
- How you will improve RMAN performance?
- Difference between OEM 12c and 13c?
- If we remove a database target from OEM does it remove the database from the host or just monitoring?
- How to remove an agent from the host?
- How does authentication happen in Oracle Database? Where it will authenticate in DB and OS system?
- Tell me about Oracle Architecture? & What are the Instance and Database?
- What is LGWR? How many LGWR is there, can we increase LGWR?
- If LGWR is slow then what could be the reason for that? How you will troubleshoot? What would the solution you could give?
- How you will export the 8i database to 12c? In testing, it is taking 2 hours and in production, now it is taking 4 hours what you will check? how you could improve the performance of this activity?
- How you will migrate the database using RMAN? If it is slow, how you will increase the performance?
- How you will Migrate using a Data pump?
- What is the prerequisite required for data pump export and Import?
- If performance is slow in the Data pump, what will you do?
- How you will monitor this Data pump activity?
- Data-pump is an optional process in GG, then why Oracle recommends it to use?
- How you will log in to the GG console?
- How will you check GG is running on the server or not?
- What you will check if the SELECT query is running slow?
- You generate an explain plan and found that full table scan, how you can avoid that, what is your suggestion on this?
- What is the difference between a full table scan and an index scan?
- Which one is better, a full table scan, or Index scan?
- What are db file sequential read Wait Event & db file scattered read Wait Event?
- If I have to update one column value, what will happen in the background? How many memory components and processes will involve in this transaction?
- Can we increase the DB writer process and MAX DB writer processes? What will be the benefit I will get if I increase it?
- What are the karnal parameters dba will set in the database Installation?
- What is shmmni, shmall & shmmax?
- What is MMAN, MMON processes?
- Data got deleted from a table, how you will recover?
- Can we perform the table recovery in 11g or not?
- The value of the Standby management parameter is manual, and activities are going on in production, what will you do to sync standby?
- What is the data guard protection mode? and what are the difference among all?
- What are the processes involved in Data guard?
- If the archive is not being applied on DG, from where you will start troubleshooting? and which is the dynamic view to check an error?
- What are the main processes of the golden gate?
- What is the difference between exp/imp and expdp/impdp?
- What is the difference between delete and truncate command?
- What is cache fusion? Which process do cache fusion?
- Earlier we had a buffer option to speed up logical backup. Which option do we use now in 11g?
- What is the ORA-01555 error?
- What is a flashback and what is mandatory for a flashback?
- We have two database D1 and D2 and the D1 database doesn't have space so how will you take an export of D1?
- You are using Toad and you are running procedure and you get a TNS error what is the reason?
- Where is the location of the RAC CRS cluster alert log?
- If the undo file is corrupted what will you do?
- How to create ACFs?
- What is async noaffirm?
- What is the backup location of OCR?
- What is the actual size and mirror size in V$ASM_DISKGROUP?
- How many IPs are configured in HAIP and why it is used and can we replace it with something?
- How to check if HAIP is up and down?
- Public and private are on the same subnet mask or different?
- What is block change tracking and when it is used before level 0,level1, or after that?
- How to set FRA?
- How to set a recycle bin?
- How to do schema refresh?
- How to check the backup completed or not?
- How to check which query is taking a long time?
- How to check tablespace is full or not?
- How to unlock the schema?
- How you will check about the patch?
- What is the snapshot too old error?
- If we take a full backup on Wednesday and after that, we take incremental backup on Tuesday and Friday, and on Sunday database crashed so how you will perform recovery?
- How to add datafile?
- How to resize tablespace?
- How to resize the logfile member?
- What happens if we kill SMON process?
- What is the diffrent b/w user and schema?
- What is the diffrent b/w rman back and import export?
- How to check the location of CRSD files?
- If we create a new database which parameter is important to check?
- What is the process of the startup?
- What is the different b/w incremental and cumulative backup?
- What is the hot and cold backup.?
- How to resize the redo log member?
- Tell me the mandatory background process?
- We have multiple control files in multiple locations. and we lost
- control file so how to recover control file?
- How to give permission to access the database?
- What is cloning?
- What is Rman cloning?
- What is a materialized view?
- What is the undo management? What happens if we delete some rows and give commit? How to rollback data?
- What is the prerequisite of RAC?
- What is cache fusion?
- What is the prerequisite of the data guard?
- What is Fragmentation in Oracle Database?
- What is Table Fragmentation in Oracle Database?
- Can we transfer the data between Linux to Windows?
- Difference between b-tree and bitmap index.
- How to troubleshoot a slow running query in Oracle?
- What is GC cr request in RAC?
- Which BR strategy is good for prod DB?
- 2 Tb schema how you will refresh?
- How will you ensure your patch is applied successfully?
- What are the minimum required parameters in pfile?
- What is Rolling Upgrade in Oracle RAC?
- How to Fix the log switches problem?
- Tell me Oracle Database “19c New Features”?
- How to check ASM status?
- How you will do ASM metadata backup?
- How many disks in ASM Normal Redundancy?
- How to fix the gap in the data guard?
- How to create a data guard?
- Difference between DBFile Sequential and Scattered Reads?
- How to recover Table in oracle database?
- If your current redo member got corrupted, will the database hang? If yes, how will you overcome this situation?
- If you have increment level 0 backup and you have to restore it on a fresh server, how will you do it?
- When do you propose a RAC solution to your business client? Why RAC environment is beneficial over a single instance database?
- What is the difference between maximum performance, maximum protection & maximum availability in Data Guard?
- What is the Default mode in Data Guard?
- What is the Difference between Incremental Differential and Incremental Cumulative backup?
- If LOB object is taking much time to export what will be your action?
- If node evictions occur? what will be your approach?
- How many voting disks are required to set up the RAC?
- If you have added datafile in the primary database but it was not added in standby due to space issue, then what will you do to correct it?
- If the Archiver process killed, then what will be the impact on the database?
- Why do you prefer the data pump over exp/imp?
- What is the parameter to make data pump operation faster?
- What is the parameter used to take consistent backup?
- What flashback_scn does?
- If you came in shift and you have to monitor an ongoing import job, how will you do it?
- How to resume a data pump job and from where it will take info?
- Tell me common wait events in the database?
- What precautions will you take before upgrading the production database?
- If your upgrade is failed for some reason, and the client wants the database to be running ASAP, how can you do that?
- If archives are not shipping to standby what are the different reasons?
- What is relation b/w DB time and elapsed time and no CPU?
- What is logfile sync?
- RAC installation steps?
- How to upgrade 11.2.0.1 to 11.2.0.3 database?
- How to apply rolling and non-rolling patches and auto patches?
- What will happen if grid unlocks?
- What are the issues faced in RAC?
- Why node eviction will occur?
- How to take the backup of OCR File and Voting Disk?
- How to run and read the execution plan?
- In the case of OS patch what will be your task as a dba?
- Difference between physical and logical standby?
- What is the Functionality of the dg broker?
- How do u monitor databases on a daily basis?
- What is automatic memory management?
- How to rename a datafile?
- If I set memory_max_target to 8gb and want to set memory_target to 10gb. How can I do it?
- If you have 10GB memory for your instance from which 4GB is allocated to SGA. Now I have made 20GB memory available for your instance and want to change SGA size to 8GB. How can you do it? Will there be any limitations to do this?
- How to check free space in ASM disk?
- How to take a backup of Voting Disk?
- How to check the location of the Voting Disk?
- How many IPs you have in 2 node RAC?
- What is SCAN?
- How the SCAN is useful in 11g?
- What is VIP?
- What is the use of Public IP, Private IP, VIP & SCAN IP use in RAC?
- How the Client gets Connected to Instance?
- If you have many instances in the RAC environment, how clients connect to a particular instance?
- How to check the index on a particular table?
- What is the difference between 11g and 12c RMAN?
- If your restoration got failed for some reason, then how you can resume it in RMAN?
- What action you will take to avoid Archive full issue?
- Where are redo logs stored in RAC? Locally or shared storage?
- How to identify the master node in RAC?
- If one node goes down, then services will failover to which node?
- What are OLR and OCR?
- Why we should have an odd number of voting disks?
- Explain the startup sequence of Clusterware?
- What happens in the background during switchover?
- What is Dynamic Sampling?
- What is the purpose of kernel parameters?
- What are diff b/w exp/imp and data pump?
- What is partitioning? & on what basis you will do the partitioning?
- Which parameters affect the performance of dB?
- How to increase the restore speed in database recovery?
- How to restore crashed undo?
- Why the data pump is fast?
- What is oracle restart?
- If the user has dropped the table, how will u recover it?