Sunday, February 19, 2023

How to install, configure, and use Statspack in Oracle database step by step ?

High Level steps for Statspack install and configure :



1. How to check Statspack installed or not ?

    select * from stats$level_description;


    *If no output and error "table doesn't exists" 


2. Create sperate tablespace for keep Statspack  objects 


create tablespace stat_pack datafile '/u01/app/oracle/oradata/INDIA/stat_pack01.dbf' size 500M autoextend on maxsize 30G;


#####################################################################

For Statspack installation, need to run below command using sysdba login 

#####################################################################


@/u01/app/oracle/product/19.0/dbhome1/rdbms/admin/spcreate.sql


SQL>

SQL> @/u01/app/oracle/product/19.0/dbhome1/rdbms/admin/spcreate.sql


Session altered.


Choose the PERFSTAT user's password

---------------------------------------------------

Not specifying a password will result in the installation FAILING


Enter value for perfstat_password: perfstat

perfstat



Choose the Default tablespace for the PERFSTAT user

---------------------------------------------------

Below is the list of online tablespaces in this database which can

store user data.  Specifying the SYSTEM tablespace for the user's

default tablespace will result in the installation FAILING, as

using SYSTEM for performance data is not supported.


Choose the PERFSTAT users's default tablespace.  This is the tablespace

in which the STATSPACK tables and indexes will be created.


TABLESPACE_NAME                CONTENTS

------------------------------ ---------------------

STATSPACK DEFAULT TABLESPACE

----------------------------

STAT_PACK                      PERMANENT



SYSAUX                         PERMANENT

*


USERS                          PERMANENT




Pressing <return> will result in STATSPACK's recommended default

tablespace (identified by *) being used.


Enter value for default_tablespace: STAT_PACK


Using tablespace STAT_PACK as PERFSTAT default tablespace.



Choose the Temporary tablespace for the PERFSTAT user

-----------------------------------------------------

Below is the list of online tablespaces in this database which can

store temporary data (e.g. for sort workareas).  Specifying the SYSTEM

tablespace for the user's temporary tablespace will result in the

installation FAILING, as using SYSTEM for workareas is not supported.


Choose the PERFSTAT user's Temporary tablespace.


TABLESPACE_NAME                CONTENTS              DB DEFAULT TEMP TABLESPACE

------------------------------ --------------------- --------------------------

TEMP                           TEMPORARY             *


Pressing <return> will result in the database's default Temporary

tablespace (identified by *) being used.


Enter value for temporary_tablespace: TEMP


Using tablespace TEMP as PERFSTAT temporary tablespace.



... Creating PERFSTAT user



... Installing required packages



... Creating views



... Granting privileges

.

.

.

…………will take 2 min to complete , need to check there is no error 



############################

Below parameter should true 

#############################


SQL> show parameter timed_statistic


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

timed_statistics                     boolean     TRUE

SQL>



##########################################

To check Statspack Level for take snapshot

############################################


SQL> l

  1* select * from stats$level_description

SQL> /


SNAP_LEVEL DESCRIPTION

---------- ------------------------------------------------------------

         0 This level captures general statistics, including rollback s

           egment, row cache, SGA, system events, background events, se

           ssion events, system statistics, wait statistics, lock stati

           stics, and Latch information


         5 This level includes capturing high resource usage SQL Statem

           ents, along with all data captured by lower levels


         6 This level includes capturing SQL plan and SQL plan usage in

           formation for high resource usage SQL Statements, along with

            all data captured by lower levels


         7 This level captures segment level statistics, including logi

           cal and physical reads, row lock, itl and buffer busy waits,

            along with all data captured by lower levels


        10 This level includes capturing Child Latch statistics, along

           with all data captured by lower levels



############################################

Login with perfstat user and take snapshot 

##############################################



[oracle@10.22.3333.2222 admin]$ sqlplus perfstat/perfstat

SQL>

SQL> show user

USER is "PERFSTAT"

SQL>

SQL> select name,snap_id,to_char(snap_time,'DD-MON-YYYY:HH24:MI:SS')

     "Date/Time" from stats$snapshot,v$database;


SQL> execute statspack.snap(i_snap_level=>10);

PL/SQL procedure successfully completed.



########################

To run report 

######################


[oracle@10.22.3333.2222 admin]$

[oracle@10.22.3333.2222 admin]$ sqlplus perfstat/perfstat


SQL*Plus: Release 19.0.0.0.0 - Production on Tue Dec 6 07:45:00 2022

Version 19.3.0.0.0


Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Last Successful login time: Tue Dec 06 2022 07:41:01 +00:00


Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0


SQL>


SQL> @/u01/app/oracle/product/19.0/dbhome1/rdbms/admin/spreport.sql


Current Instance

~~~~~~~~~~~~~~~~


   DB Id    DB Name      Inst Num Instance

----------- ------------ -------- ------------

 3280227920 INDIA               1 india




Instances in this Statspack schema

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


   DB Id    Inst Num DB Name      Instance     Host

----------- -------- ------------ ------------ ------------

 3280227920        1 INDIA        india        ip-172-31-19

                                               -40.ec2.inte

                                               rnal


Using 3280227920 for database Id

Using          1 for instance number



Specify the number of days of snapshots to choose from

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Entering the number of days (n) will result in the most recent

(n) days of snapshots being listed.  Pressing <return> without

specifying a number lists all completed snapshots.




Listing all Completed Snapshots


                                                       Snap

Instance     DB Name        Snap Id   Snap Started    Level Comment

------------ ------------ --------- ----------------- ----- --------------------

india        INDIA                1 06 Dec 2022 07:38    10

                                  2 06 Dec 2022 07:41    10

                                  3 06 Dec 2022 07:41    10

                                  4 06 Dec 2022 07:41    10

                                  5 06 Dec 2022 07:41    10




Specify the Begin and End Snapshot Ids

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Enter value for begin_snap: 1

Begin Snapshot Id specified: 1


Enter value for end_snap: 5

End   Snapshot Id specified: 5




Specify the Report Name

~~~~~~~~~~~~~~~~~~~~~~~

The default report file name is sp_1_5.  To use this name,

press <return> to continue, otherwise enter an alternative.


Enter value for report_name: sp_1_5_report_india


Using the report name sp_1_5_report_india


Friday, February 17, 2023

Checking swap space: 0 MB available, 150 MB required. Failed

Checking swap space: 0 MB available, 150 MB required.    Failed 


[oracle@oracle12c database]$ ./runInstaller

Starting Oracle Universal Installer...


Checking Temp space: must be greater than 500 MB.   Actual 1991 MB    Passed

Checking swap space: 0 MB available, 150 MB required.    Failed 

Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed


Some requirement checks failed. You must fulfill these requirements before


continuing with the installation,


User Selected: No



Solution :

Need to add swap space 




[root@oracle12c ~]# free -g
              total        used        free      shared  buff/cache   available
Mem:              7           0           2           0           4           6
Swap:             1           0           1
[root@oracle12c ~]#

Thursday, February 16, 2023

How to check the valid components loaded into the database (JVM,XML,XDK,Oracle Label Security......) ?

How to check the valid components loaded into the database ?


Login as privilege user and run below commands : 


SQL> select * from all_registry_banners;


BANNER                                                                           BANNER_FULL

-------------------------------------------------------------------------------- --------------------------------------------------------------------------------------

Oracle Database Catalog Views Release 19.0.0.0.0 - Production                    Oracle Database Catalog Views Release 19.0.0.0.0 - Production Version 19.3.0.0.0

Oracle Database Packages and Types Release 19.0.0.0.0 - Production               Oracle Database Packages and Types Release 19.0.0.0.0 - Production Version 19.3.0.0.0

Oracle XML Database Release 19.0.0.0.0 - Production                              Oracle XML Database Release 19.0.0.0.0 - Production Version 19.3.0.0.0

Oracle Workspace Manager Release 19.0.0.0.0 - Production                         Oracle Workspace Manager Release 19.0.0.0.0 - Production Version 19.3.0.0.0

JServer JAVA Virtual Machine Release 19.0.0.0.0 - Production                     JServer JAVA Virtual Machine Release 19.0.0.0.0 - Production Version 19.3.0.0.0

Oracle XDK Release 19.0.0.0.0 - Production                                       Oracle XDK Release 19.0.0.0.0 - Production Version 19.3.0.0.0

Oracle Database Java Packages Release 19.0.0.0.0 - Production                    Oracle Database Java Packages Release 19.0.0.0.0 - Production Version 19.3.0.0.0

Oracle Text Release 19.0.0.0.0 - Production                                      Oracle Text Release 19.0.0.0.0 - Production Version 19.3.0.0.0

Oracle Multimedia Release 19.0.0.0.0 - Production                                Oracle Multimedia Release 19.0.0.0.0 - Production Version 19.3.0.0.0

OLAP Analytic Workspace Release 19.0.0.0.0 - Production                          OLAP Analytic Workspace Release 19.0.0.0.0 - Production Version 19.3.0.0.0

Oracle OLAP API Release 19.0.0.0.0 - Production                                  Oracle OLAP API Release 19.0.0.0.0 - Production Version 19.3.0.0.0

Spatial Release 19.0.0.0.0 - Production                                          Spatial Release 19.0.0.0.0 - Production Version 19.3.0.0.0

Oracle Label Security Release 19.0.0.0.0 - Production                            Oracle Label Security Release 19.0.0.0.0 - Production Version 19.3.0.0.0

Oracle Database Vault Release 19.0.0.0.0 - Production                            Oracle Database Vault Release 19.0.0.0.0 - Production Version 19.3.0.0.0



14 rows selected.


SQL>

Monday, February 13, 2023

Login using SSH into a new EC2 instance created from an custom AMI (image)

 Not able to login (SSH) to EC2 running Linux(Custom AMI)


Solution 

Login as ec2-user 

sudo su - root 


first use source *.pem key to login ec2 instance launch from custom AMI using ec2-user 

enable PasswordAuthentication to yes


vi /etc/ssh/sshd_config


PasswordAuthentication yes


systemctl restart sshd



then login with root user with same password as source.