Wednesday, August 11, 2021

Oracle Database Security Assessment Tool

 1- Download Oracle Database Security Assessment Tool using below link.


https://www.oracle.com/database/technologies/security/dbsat.html


2- Download Java JDK RPM if not already installed.

https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html

3- Now install Java

   rpm -Uvh jdk-8u181-linux-x64.rpm

4- Export Java Variables

export JAVA_HOME=/usr/java/jdk1.8.0_181-amd64

export PATH=$JAVA_HOME/bin:$PATH


5- Now Unzip DB stat file into any directory.
cd /u01/app/oracle/
unzip /backup/dbsat.zip
cd /u01/app/oracle/dbstat/


6- Now Run DB State Tool 

 ./dbsat collect system/yourpassword /u01/app/oracle/dbstat/statreport

This will create a new zip file named as statreport.

./dbstat collect system/yourpassword  /u01/app/oracle/dbstat/statreport

./dbsat report  /u01/app/oracle/dbstat/statreport


Now cd to discoverer folder.
cd Discover/

and copy sample_dbsat.config  to dbstat_config and change hostname and service_name and port no in this file.

 ./dbsat discover -c Discover/conf/dbstat_config nameofdatabase


After successful execution of last command. New zip file named as dbname_report.zip will be created. Copy this file to your machine and open .html file.






7- 

Saturday, July 10, 2021

Oracle 12c New Feature: How to recover table using rman.

 How to recover a table in Oracle 12c Pluggable Database Using RMAN.


09:32:19 SQL> 

09:33:19 SQL> 

09:36:19 SQL> Create table hr.emp as select * from hr.employees;


rman target /

RMAN> backup as compressed backupset incremental level 0 database format '/backup/incr_bkp%U';


09:50:22 SQL> drop table hr.emp purge;


rman target/


RMAN> recover table hr.emp of pluggable database pdb  until time "to_date('10/07/2021 09:40:00','dd/mm/yyyy hh24:mi:ss')" auxiliary destination '/backup' datapump destination '/backup';


RMAN> recover table hr.emp of pluggable database pdb  until time "to_date('10/07/2021 20:15:00','dd/mm/yyyy hh24:mi:ss')" auxiliary destination '/backup';



09:59:19 SQL> select count(*) from hr.emp

Sunday, June 6, 2021

How to register PDB with Listener

 LISTENER_DBATEST =

 (DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbatest-host)(PORT = 1573))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1573))
)
)
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_PDB_LISTENER=ON # line added by Agent
VALID_NODE_CHECKING_REGISTRATION_PDB_LISTENER=SUBNET # line added by Agent


lsnrctl start LISTENER_DBATEST

Sunday, March 1, 2020

Oracle 12c - Can not login to Enterprise Manager - XDB Login prompt


I have installed Oracle 12c Enterprise Edition on one of my Windows 7/Linux. 
I can as well login to Oracle Web Enterprise Manager (It runs on https://(hostname):5500/em ) using SYS & SYSTEM passwords without specifying any database. However in case of Web Enterprise Manager the moment I choose a database container (See the screenshot, left side login prompt) despite entering correct userid/password it prompts for yet another weblogin prompt. I am clueless what to enter here.
I tried SYS & SYSTEM passwords but it did not help. During installation, it asked for an additional admin password that too does not work here. I also tried unlocking XDB & Anonymous accounts and restarted Database & listener but it did not help. tnsnames.ora has entries for both ORCL & ORCLPDB.
Does anyone have any idea what this login is for and how to proceed further?
Thanks.






You should enable global port for EM Express to Manage a CDB and the PDBs, execute:
exec dbms_xdb_config.SetGlobalPortEnabled(TRUE);

Sunday, July 29, 2018

Using the ESXi command-line utility vim-cmd to power on/off the virtual machine

How to get status of all virtual machines using command line utility of Esxi 6


vim-cmd vmsvc/getallvms



Start Machine
vim-cmd vmsvc/power.on Vmid
vim-cmd vmsvc/power.on 70




Stop Machine
vim-cmd vmsvc/power.shutdown Vmid
vim-cmd vmsvc/power.shutdown 70


How to configure password less connectivity between Linux servers - rsa keys generation on linux

In my environment i have two machines named testa and testb.

Step 1- Generate rsa keys on both machines.

ssh-keygen -t rsa







Step 2: Create a file named authorized keys on both machines.

touch ~/.ssh/authorized_keys


Now copy public key from testa to testb and from testb to testa

ssh-copy-id -i ~/.ssh/id_rsa.pub testb

ssh-copy-id -i ~/.ssh/id_rsa.pub testa







Monday, April 18, 2016

Database Statistics Export/Import



Introduction
There may be times that you wish to save you database statistics. Perhaps to use in a test system or prior to a code release that may ultimately change your statistics and change your query plans for the worse. By exporting the statistics, they can be saved for future importing.
Step by Step Export of Database Statistics
1. Log onto the database 
      sqlplus '/ as sysdba'
2. Create a table to hold the exported statistics. 
  SQL> exec DBMS_STATS.CREATE_STAT_TABLE('<table owner>','<enter a name for the stats      table>','<tablespace to store the stats table');
For example; exec dbms_stats.create_stat_table('SCOTT','MYSTATTABLE','USERS');
3. Export the database statistics 
SQL> exec dbms_stats.EXPORT_DATABASE_STATS('<enter the name of the stats table>','<enter an identifier>','<enter the owner of the stats table>');
For example;
exec dbms_stats.export_database_stats('MYSTATTABLE','R1','SCOTT');
Now Export this Table with Exp utility.
exp scott/password file=mystattable.dmp tables=mystattable
And Import in Target DB.
imp scott/password file=mystattable.dmp full=y
Step by Step Import of Database Statistics
1. Log onto the database 
  sqlplus '/ as sysdba'
2. Import the database statistics
SQL> exec dbms_stats.IMPORT_DATABASE_STATS('<enter the name of the stats table>','<enter an identifier>','<enter the owner of the stats table>');
For example; 
exec dbms_stats.IMPORT_DATABASE_STATS('STATTABLE','R2','SCOTT');