IMP#### Self Help Portal for reset windows password:-
https://ithelpdesk.jolcorp.info/Summitprod/MDLSMSMGMT/Summit_SMS_ManageAccount.aspx
````````````````````````````````````
Check databases view.
````````````````````````````````````
set lines 200 pages 3000 colsep '|'
col name for a15;
col log_mode for a15;
col open_mode for a15;
col force_logging for a5;
col flashback_on for a5;
col database_role for a15;
select NAME,LOG_MODE,OPEN_MODE,FORCE_LOGGING,FLASHBACK_ON,DATABASE_ROLE,CDB from
v$database;
###################################################################################
###################################################################################
######################################################################
````````````````````````````````````
check datafiles view.
````````````````````````````````````
set lines 200 pages 3000;
col name for a70;
col status for a10;
col AUX_NAME for a10;
col last_time for a10;
select FILE#,NAME,STATUS,BYTES/1024/1024/1024,AUX_NAME,BLOCKS,LAST_TIME from
v$datafile;
###################################################################################
###################################################################################
######################################################################
````````````````````````````````````
check user management view.
````````````````````````````````````
set lines 300 pages 3000 colsep |;
col USERNAME for a25;
col ACCOUNT_STATUS for a20;
col PROFILE for a15;
col DEFAULT_TABLESPACE for a25;
col TEMPORARY_TABLESPACE for a25;
select
username,ACCOUNT_STATUS,CREATED,EXPIRY_DATE,PROFILE,DEFAULT_TABLESPACE,TEMPORARY_TA
BLESPACE from dba_users where username in
('JARVIS','JARVO','OBE','ACC_EMP','TEST');
desc all_users; <-------special view.
HOW TO CHECK TABLES
desc dba_tables.
HOW TO CHECK INDEXES
desc dba_indexes.
``````````````````````````````````````````````````````````````
Indexes
``````````````````````````````````````````````````````````````
desc all_indexes;
desc dba_indexes;
set line 200 pages 30000;
col owner for a30;
col index_name for a35;
col table_owner for a33;
select
owner,index_type,index_name,table_owner,table_type,compression,tablespace_name from
all_indexes where tablespace_name='LNAPPPRD_IDX';
alter index <index_name> rebuild online parallel;
alter index <index_name> rebuild tablespace<tablespace_name>;
```````````````````````````````````````````````````
how to check table owner.
````````````````````````````````````````````````````
desc dba_tables for check owner
desc dba_tab_privs for check privilege accessed.
desc user_sys_privs.
desc ALL_TAB_PRIVS
how to get any access in different tables
grant select,insert,update,delete, on owner.table_name to username whome i provide.
###################################################################################
###################################################################################
######################################################################
````````````````````````````````````
check db_link view.
````````````````````````````````````
How to create database link.
CREATE DATABASE LINK link_name CONNECT TO username IDENTIFIED BY password USING
'service_name';
create database link
set lines 200 pages 3000;
col owner for a20;
col db_link for a30;
col username for a30;
select owner,db_link,username from all_db_links;
###################################################################################
###################################################################################
######################################################################
````````````````````````````````````
check tablespace management view.
````````````````````````````````````
set lines 200 pages 3000 colsep '|';
col file_name for a65;
col TABLESPACE_NAME for a25;
set lines 300 pages 3000;
col File_Size for 999999999
col Max_Size for 999999999
select TABLESPACE_NAME,FILE_NAME,AUTOEXTENSIBLE,BYTES/(1024*1024*1024)
File_Size_GB,MAXBYTES/(1024*1024*1024) Max_Size_GB from dba_data_files; where
tablespace_name='SYSAUX';
CREATE TABLESPACE.
~~~~~~~~~~~~~~~~~~~~~~~~~~~
create tablespace tablespace_name datafile 'PATH' size 10mb autoextend on maxsize
(unlimited); ------->when you create.all time ask your client.
ADD TABLESPACE.
~~~~~~~~~~~~~~~~~~~~~~~~~~
alter tablespace sysaux add datafile 'H:\BJLS\SYSAUX.417.1027175423.DBF' size 16g;
RESIZE TABLESPACE.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alter database datafile 'PATH' resize 10g;
HOW TO CHECK FULL DATABASE SIZE.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
select sum(bytes)/1024/1024/1024 from dba_segments;
SUM(BYTES)/1024/1024/1024
-------------------------
54.6565552
set lines 200 pages 4000;
col username for a30;
select tablespace_name,username,max_bytes/1024/1024 as maxbytes,bytes/1024/1024 as
used_data from dba_ts_quotas where username='TEST';
HOW TO CHECK HOW MANY DATAFILE USED.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
free space check view:- desc dba_tablespace_usage_metrics;
select * from dba_tablespace_usage_metrics;
desc USER_TABLESPACES; <--- special view.
````````````````````````````````````
check temporary tablespace view.
````````````````````````````````````
set lines 200 pages 3000 colsep '|';
col file_name for a65;
col TABLESPACE_NAME for a25;
set lines 300 pages 3000;
col File_Size for 999999999
col Max_Size for 999999999
select TABLESPACE_NAME,FILE_NAME,AUTOEXTENSIBLE,BYTES/(1024*1024*1024)
File_Size_GB,MAXBYTES/(1024*1024*1024) Max_Size_GB from dba_temp_files;
###################################################################################
###################################################################################
######################################################################`````````````
```````````````````````
check directroies view.
````````````````````````````````````
HOW TO SCHECDULE JOB FOR 4 DAYS EXPORT BACKUP.
set ORACLE_HOME=E:\app\srv_rman\product\12.1.0\dbhome_1
set PATH=E:\DB_Backup\Oracle\Logical_Bkps
set ORACLE_SID=BIOSPROD
expdp sys/sys full=y directory=Logical_Bkps dumpfile=backup_%U.dmp
logfile=export.log parallel=3 compression=all
set line 140 pages 3000;
col owner for a10;
col directory_name for a20;
col directory_path for a60;
select owner,directory_name,directory_path from dba_directories;
export tables.
~~~~~~~~~~~~~~~~~~~
how to create directories.
create directory <directory_name> as <path> <--------you want to give any path.
single table export.
~~~~~~~~~~~~~~~~~~~~~~~~~~~
expdp \"/as sysdba\" dumpfile=export_exp_13may2024.dmp
logfile=export_exp_13may2024.log directory=expdp_backup tables=test.aus
multiple tables export.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
expdp \"/as sysdba\" dumpfile=expdp_exp_13may2024.dmp
logfile=expdp_exp_13may2024.log directory=expdp_backup
tables=test.acc,test.aus,test.casio,test.mac,test.master
!expdp \"/as sysdba\" dumpfile=expdp_exp_13may2024.dmp
logfile=expdp_exp_13may2024.log directory=expdp_backup
tables=test.acc,test.aus,test.casio,test.mac,test.master
Export: Release 19.0.0.0.0 - Production on Mon May 13 16:08:03 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
Password:
Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 -
Production
Warning: Oracle Data Pump operations are not typically needed when connected to the
root or seed of a container database.
Starting "SYS"."SYS_EXPORT_TABLE_01": "/******** AS SYSDBA"
dumpfile=expdp_exp_13may2024.dmp logfile=expdp_exp_13may2024.log
directory=expdp_backup tables=test.acc,test.aus,test.casio,test.mac,test.master
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
Processing object type TABLE_EXPORT/TABLE/TABLE
. . exported "TEST"."CASIO" 11.00 MB 524288 rows
. . exported "TEST"."ACC" 11.00 MB 524288 rows
. . exported "TEST"."AUS" 11.00 MB 524288 rows
. . exported "TEST"."MAC" 11.00 MB 524288 rows
. . exported "TEST"."MASTER" 11.00 MB 524288 rows
Master table "SYS"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SYS_EXPORT_TABLE_01 is:
/u01/app/oracle/expdp_backup/expdp_exp_13may2024.dmp
Job "SYS"."SYS_EXPORT_TABLE_01" successfully completed at Mon May 13 16:09:17 2024
elapsed 0 00:01:10
how to check status
~~~~~~~~~~~~~~~~~~~~~~~~~~
expdp attach="SYS"."SYS_EXPORT_FULL_01"
````````````````````````````````````
check rman code.
````````````````````````````````````
Q- HOW TO TAKE RMAN FULL BACKUP COMMAND GIVEN BELOW.
run
{
allocate channel s1 device type disk;
allocate channel s2 device type disk;
allocate channel s3 device type disk;
backup as compressed backupset database format '/u01/app/oracle/rman_backup/full_
%d_%t_%U.bkp';
backup current controlfile format '/u01/app/oracle/rman_backup/ctl_%d_%t_%U.bkp';
backup archivelog all format '/u01/app/oracle/rman_backup/arch_%d_%t_%U.bkp';
backup spfile format '/u01/app/oracle/rman_backup/spfile_%d_%t_%U.bkp';
release channel s1;
release channel s2;
release channel s3;
}
HOW TO TAKE SIMEPLE DABABASE BACKUP USING RMAN?
backup database format '/u01/app/oracle/rman_backup/full_%d_%t_%U.bkp';
````````````````````````````````````
check rman_backup_job_detail code. <---- how to check rman job detail?
````````````````````````````````````
set line 150 pages 3000;
COL HOURS FOR 9999.99
COL STATUS FOR A10
select SESSION_KEY,INPUT_TYPE,STATUS,
to_char(start_time,'mm-dd-yyyy hh24:mi:ss') as RMAN_BACKUP_START_TIME,
to_char(end_time,'mm-dd-yyyy hh24:mi:ss') as RMAN_BACKUP_END_TIME,
elapsed_seconds/3600 hours from v$RMAN_BACKUP_JOB_DETAILS order by session_key;
````````````````````````````````````
check during backup status code.
````````````````````````````````````
Q> how to check rman job status when our backup is running on database?
SELECT SID, SERIAL#, CONTEXT, SOFAR, TOTALWORK,
ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE"
FROM V$SESSION_LONGOPS
WHERE OPNAME LIKE 'RMAN%'
AND OPNAME NOT LIKE '%aggregate%'
AND TOTALWORK != 0
AND SOFAR <> TOTALWORK;
````````````````````````````````````
check controlfile.
````````````````````````````````````
set lines 200 pages 3000;
col name for a70;
select name,status,block_size from v$controlfile;
````````````````````````````````````
cdb and pdb
````````````````````````````````````
how to check which database we are connected cdb & pdb?
show con_name <----------- important command.
how to check how many database we have?
show pdbs / v$pdbs.
````````````````````````````````````````````````````
HOW TO SCHEDULE SUDIT LOG JOBS;
```````````````````````````````````````````````````
BEGIN
DBMS_SCHEDULER.create_job (
job_name => 'PURGE_UNIFIED_AUDIT_JOB',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN',
DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP(DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,
SYSTIMESTAMP-10);
DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(
audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,
use_last_arch_timestamp => TRUE);
END;
````````````````````````````````````````````````````
HOW TO SCHEDULE SUDIT LOG JOBS;
```````````````````````````````````````````````````
BEGIN
DBMS_SCHEDULER.create_job (
job_name => 'test_full_job_definition',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN my_job_procedure; END;',
start_date => SYSTIMESTAMP,
repeat_interval => 'freq=hourly; byminute=0; bysecond=0;',
enabled => TRUE);
END;
/
``````````````````````````````````````````````````````````````
Indexes
``````````````````````````````````````````````````````````````
desc all_indexes;
desc dba_indexes;
set line 200 pages 30000;
col owner for a30;
col index_name for a35;
col table_owner for a33;
select
owner,index_type,index_name,table_owner,table_type,compression,tablespace_name from
all_indexes where tablespace_name='LNAPPPRD_IDX';
alter index <index_name> rebuild online parallel;
alter index <index_name> rebuild tablespace<tablespace_name>;
```````````````````````````````````````````````````
how to check table owner.
````````````````````````````````````````````````````
desc dba_tables for check owner
desc dba_tab_privs for check privilege accessed.
desc user_sys_privs.
desc ALL_TAB_PRIVS
how to get any access in different tables
grant select,insert,update,delete, on owner.table_name to username whome i provide.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~
primary and DR checking status.
```````````````````````````````````
FOR DC :
select thread#, max(sequence#) "Last Primary Seq Generated"
from v$archived_log val, v$database vdb
where val.resetlogs_change# = vdb.resetlogs_change#
group by thread# order by 1;
---------------------------------------------------------------------------------
FOR DR :
select thread#, max(sequence#) "Last Standby Seq Received"
from v$archived_log val, v$database vdb
where val.resetlogs_change# = vdb.resetlogs_change#
group by thread# order by 1;
select thread#, max(sequence#) "Last Standby Seq Applied"
from v$archived_log val, v$database vdb
where val.resetlogs_change# = vdb.resetlogs_change#
and val.applied in ('YES','IN-MEMORY')
group by thread# order by 1;