ADDING BLOCK VOLUME to OCI COMPUTE INSTACE

login as: opc
Authenticating with public key "rsa-key-20190505"
Last login: Sun May  5 09:02:03 2019 from 157.44.132.21
[opc@testclouddb ~]$ sudo su -
Last login: Sun May  5 09:22:53 GMT 2019 on pts/2
[root@testclouddb ~]# clear
[root@testclouddb ~]# adding mountpoing
-bash: adding: command not found
[root@testclouddb ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        7.2G     0  7.2G   0% /dev
tmpfs           7.3G     0  7.3G   0% /dev/shm
tmpfs           7.3G  8.8M  7.3G   1% /run
tmpfs           7.3G     0  7.3G   0% /sys/fs/cgroup
/dev/sda3        39G  1.9G   37G   5% /
/dev/sda1       200M  9.7M  191M   5% /boot/efi
tmpfs           1.5G     0  1.5G   0% /run/user/1000
/dev/sdb       1008G   72M  957G   1% /u01
tmpfs           1.5G     0  1.5G   0% /run/user/0
[root@testclouddb ~]# adding mount u02
-bash: adding: command not found
[root@testclouddb ~]# copying iscsi commands which is avilable in instance -->attach block volume -->details-->iscsi commands
-bash: copying: command not found
[root@testclouddb ~]# sudo iscsiadm -m node -o new -T iqn.2015-12.com.oracleiaas:8c23597f-f1e4-4219-a4b7-60107312a478 -p 169.254.2.3:3260
New iSCSI node [tcp:[hw=,ip=,net_if=,iscsi_if=default] 169.254.2.3,3260,-1 iqn.2015-12.com.oracleiaas:8c23597f-f1e4-4219-a4b7-60107312a478] added
[root@testclouddb ~]# sudo iscsiadm -m node -o update -T iqn.2015-12.com.oracleiaas:8c23597f-f1e4-4219-a4b7-60107312a478 -n node.startup -v automatic
[root@testclouddb ~]# sudo iscsiadm -m node -T iqn.2015-12.com.oracleiaas:8c23597f-f1e4-4219-a4b7-60107312a478 -p 169.254.2.3:3260 -l
Logging in to [iface: default, target: iqn.2015-12.com.oracleiaas:8c23597f-f1e4-4219-a4b7-60107312a478, portal: 169.254.2.3,3260] (multiple)
Login to [iface: default, target: iqn.2015-12.com.oracleiaas:8c23597f-f1e4-4219-a4b7-60107312a478, portal: 169.254.2.3,3260] successful.
[root@testclouddb ~]#
[root@testclouddb ~]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sda: 50.0 GB, 50010783744 bytes, 97677312 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disk label type: gpt
Disk identifier: E612AFD4-C2DB-46D5-AB2D-C7BAD48E71FA


#         Start          End    Size  Type            Name
 1         2048       411647    200M  EFI System      EFI System Partition
 2       411648     17188863      8G  Linux swap
 3     17188864     97675263   38.4G  Microsoft basic

Disk /dev/sdb: 1099.5 GB, 1099511627776 bytes, 2147483648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes


Disk /dev/sdc: 1099.5 GB, 1099511627776 bytes, 2147483648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes

[root@testclouddb ~]# mkdir /u02
[root@testclouddb ~]# mkfs /dev/sdc
mke2fs 1.42.9 (28-Dec-2013)
/dev/sdc is entire device, not just one partition!
Proceed anyway? (y,n) n
[root@testclouddb ~]# mount /dev/sdc /u02
mount: unknown filesystem type '(null)'
[root@testclouddb ~]# mount /dev/xvdf1 /test
mount: mount point /test does not exist
[root@testclouddb ~]# mkfs /dev/sdc
mke2fs 1.42.9 (28-Dec-2013)
/dev/sdc is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=256 blocks
67108864 inodes, 268435456 blocks
13421772 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
8192 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information:
done

[root@testclouddb ~]#
[root@testclouddb ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        7.2G     0  7.2G   0% /dev
tmpfs           7.3G     0  7.3G   0% /dev/shm
tmpfs           7.3G  8.7M  7.3G   1% /run
tmpfs           7.3G     0  7.3G   0% /sys/fs/cgroup
/dev/sda3        39G  1.9G   37G   5% /
/dev/sda1       200M  9.7M  191M   5% /boot/efi
tmpfs           1.5G     0  1.5G   0% /run/user/1000
/dev/sdb       1008G   72M  957G   1% /u01
[root@testclouddb ~]# mount /dev/sdc /u02
[root@testclouddb ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        7.2G     0  7.2G   0% /dev
tmpfs           7.3G     0  7.3G   0% /dev/shm
tmpfs           7.3G  8.7M  7.3G   1% /run
tmpfs           7.3G     0  7.3G   0% /sys/fs/cgroup
/dev/sda3        39G  1.9G   37G   5% /
/dev/sda1       200M  9.7M  191M   5% /boot/efi
tmpfs           1.5G     0  1.5G   0% /run/user/1000
/dev/sdb       1008G   72M  957G   1% /u01
/dev/sdc       1008G   72M  957G   1% /u02
[root@testclouddb ~]#

DATABASE PT(TUNING) on LINUX

DATABASE PERFORMANCE TUNING

SYSTEM TUNING
SQL TUNING

SYSTEM TUNING

we can check system usage and CPU performance,if anything you have seen related system usage is high need to upgrade your  server configuration

SAR
VMSTAT

OPC is CLOUD USER

login as: opc
Authenticating with public key "rsa-key-20180924"
Last login: Tue Sep 25 18:11:58 2018 from 157.48.60.207
[opc@lava ~]$ pwd
/home/opc
[opc@lava ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        7.2G     0  7.2G   0% /dev
tmpfs           7.3G     0  7.3G   0% /dev/shm
tmpfs           7.3G   17M  7.2G   1% /run
tmpfs           7.3G     0  7.3G   0% /sys/fs/cgroup
/dev/sda3        39G  1.9G   37G   5% /
/dev/sda1       200M  9.8M  191M   5% /boot/efi
tmpfs           1.5G     0  1.5G   0% /run/user/1000
[opc@lava ~]$ uname -a
Linux lava 4.1.12-124.18.5.el7uek.x86_64 #2 SMP Mon Aug 13 16:15:23 PDT 2018 x86_64 x86_64 x86_64 GNU/Linux
[opc@lava ~]$ sar
Linux 4.1.12-124.18.5.el7uek.x86_64 (lava)      09/26/2018      _x86_64_        (2 CPU)

12:00:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:10:01 AM     all      0.03      0.00      0.01      0.00      0.00     99.95
12:20:01 AM     all      0.00      0.00      0.01      0.00      0.00     99.99
12:30:01 AM     all      0.06      0.00      0.06      0.00      0.00     99.88
12:40:01 AM     all      0.03      0.00      0.01      0.00      0.00     99.95
12:50:02 AM     all      0.00      0.00      0.01      0.00      0.00     99.99
01:00:01 AM     all      0.00      0.00      0.01      0.00      0.00     99.99
01:10:01 AM     all      0.03      0.00      0.01      0.00      0.00     99.96
01:20:01 AM     all      0.01      0.00      0.01      0.00      0.00     99.98
01:30:01 AM     all      0.01      0.00      0.01      0.00      0.00     99.99
01:40:01 AM     all      0.05      0.00      0.02      0.00      0.00     99.93
01:50:01 AM     all      0.00      0.00      0.01      0.00      0.00     99.99
02:00:01 AM     all      0.01      0.00      0.01      0.00      0.00     99.99
02:10:01 AM     all      0.03      0.00      0.02      0.00      0.00     99.95
Average:        all      0.02      0.00      0.02      0.00      0.00     99.96

02:11:33 AM       LINUX RESTART
[opc@lava ~]$ vmstat -S M
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0  14231      3    312    0    0   795    92  543 4960 12  8 78  1  0
[opc@lava ~]$ hostname
lava
[opc@lava ~]$

**Application-running user  script**

Select user_name from fnd_user where user_id in (select user_id from icx_sessions where last_connect > sysdate -24;

Select fnd.user_name,icx.responsibility_application_id,icx.responsibility_name,icx.session_id,icx.first_connect,icx.last_connect,Decode((icx.disable_flag),'N','Active','y','Inactive') status
From
Fnd_user find,icx_sessions icx,fnd_responsibility_tl frt
Where find.user_id=icx.user_id
And icx.responsibility_id=frt.responisibility_id
And icx.disabled_flag<>'Y'
And icx.last_connect> sysdate -1/24;

RMAN

Rman backup can be taken in two ways

BACKUP SET - Recovery Manager backs up the datafiles, control file, archived log files, and server parameter files in a RMAN specific format called backup pieces. A set of one or more such backup pieces makes up a backup set. A backup set is created using the BACKUP command.

IMAGE COPY - As opposed to the backup set, an image copy is not a RMAN specific format. It is a replica of an actual file. Image copies are created using the COPY command.


TARGET DATABASE - A Target Database is the primary database that will be backed up for standby database creation. In RMAN's terminology, the term target database identifies the database that is undergoing a backup, restore or recovery operation by Recovery Manager.

AUXILIARY DATABASE - An Auxiliary Database is a standby database that will be created as a result of the duplication of the target database. In RMAN's terminology, Auxiliary instance identifies an instance which RMAN connects in order to execute the duplicate command.


RESTORE:
Restore is used to restore the datafiles from a backup. You can restore up to the time of the backup or a point before using SET UNTIL cancel/TIME/SCN...etc.

example:
run 
{
set newname for database to "/u02/app/oracle/oradata/TST1/%U";
restore database until time="TO_DATE('11/13/2013 01:53:36', 'MM/DD/YYYY HH24:MI:SS')";
switch datafile all;
}
exit;


RECOVER:
You would lose any changes made to the database after the backup by performing only a RESTORE.

RECOVER is used to roll the database forward after a RESTORE by applying the redo logs

example:

run {
recover database until scn 7266782191960;
}
exit;

###Duplicate method in Rman####

Rman duplicate command uses
It is mainly used for database rename after restore
To use duplication in rman we have the below senories
1.Adding dbfilename_convert,Logfilename_convert parameters in pfile(if it source data file mounts and target mounts are same count.ex||source db saves datafiles in 3mount points and target db also saves datafiles in 3mounts)


2.set new name command in rman script(if source data file mounts and target mount are having different count.ex||source db saves datafiles in 3mount points and target db saves datafiles in 6mounts)

3.configure auxname.
By this same like set new name it will rename dbfiles but we can modify number of log files or groups.
It is necessary to connect to the recovery catalog in order to use the CONFIGURE AUXNAME command


How rman create target redologs?
RMAN uses all incremental backups, archived redo log backups, and archived redo logs to perform incomplete recovery. RMAN then shuts down, starts, and opens the database with the RESETLOGS option to create the online redo logs.

Why we don't use nofilenamecheck option in same host db?
Do not use the NOFILENAMECHECK option when duplicating to the same Oracle home as the primary database. If you do, then the DUPLICATEcommand may overwrite the datafiles of the target database.

DB_CREATE_ONLINE_LOG_DEST_n : this parameter used to specify no.of controlfiles and redologs files generation.we can specify this parameter in pfile



*****USING SBT BACKUP***********


1.Restoring Oracle Full Databases:

Put the database in MOUNT mode

run {
allocate channel ch1 type 'sbt_tape';
allocate channel ch2 type 'sbt_tape';
restore database ;
recover database;
sql “alter database open”;
}

2.Restoring Oracle Control Files

Restore control and files in the following scenarios:

If the control file is lost and you need to restore the backup repository contained in the control file
If the recovery catalog is lost
If the recovery catalog was never used
If the catalog connect string is not specified for the instance during the backup




Put the database in NOMOUNT mode.

run {
set DBID <dbid>;
allocate channel ch1 type 'sbt_tape';
restore controlfile from autobackup ;
}

3.Duplicating Oracle Database

To redirect data files, specify the DB_FILE_NAME_CONVERT init parameter in the PFILE

run {
allocate auxiliary channel ch1 type 'sbt_tape';
allocate auxiliary channel ch2 type 'sbt_tape';
DUPLICATE TARGET DATABASE TO dupdb;
PFILE = /dup/oracle/dbs/initDUPDB.ora
NOFILENAMECHECK;
}

4.Restoring Oracle Individual Tablespaces to a Point-in-Time

On the RMAN command line, set the SBT CHANNEL parameter:

RMAN> CONFIGURE CHANNEL DEVICE TYPE 'sbt_tape' PARMS="SBT_LIBRARY= <software_installation_path>/Base/libobk.so, BLKSIZE=1048576";

n the RMAN command line, run the following sample script, substituting any required or optional Oracle SBT parameters.
RMAN> RUN {
recover tablespace test1 until time = "TO_DATE('02/12/2013 16:58:43',HH24:MI:SS')" auxiliary destination '/u01/tspit/'; }


5.Redirecting an Oracle Restore Using SET NEWNAME
When you redirect a restore for Oracle database 11gR2 or later by using the SET NEWNAME FOR DATABASE, or SET NEWNAME FOR TABLESPACE commands, you must specify variables in the file name to avoid name collisions.

run
{
set newname for database to "/u02/app/oracle/oradata/TST1/%U";
restore database until time="TO_DATE('11/13/2013 01:53:36', 'MM/DD/YYYY HH24:MI:SS')";
switch datafile all;
}
exit;
run {
recover database until scn 7266782191960;
}
exit;

RMAN PERFORMANCE TUNING PARAMETERS

– Parallelism
– Maxpiecesize – Maximum size of each backup piece
– FIlesperset  _ The number of datafiles in each backupset
– Maxopenfiles – Maximum No. of files which can be read from simultaneously
– Multiplexing level
– Asynchronous / Synchronous I/O
– Large pool Size-


If You Fail to Allocate Shared Memory, Set LARGE_POOL_SIZE

  • If LARGE_POOL_SIZE is set, then the database attempts to get memory from the large pool. If this value is not large enough, then an error is recorded in the alert log, the database does not try to get buffers from the shared pool, and asynchronous I/O is not used.
  • If LARGE_POOL_SIZE is not set, then the database attempts to get memory from the shared pool.
  • If the database cannot get enough memory, then it obtains I/O buffer memory from the PGA and writes a message to the alert.log file indicating that synchronous I/O is used for this backup.The formula for setting LARGE_POOL_SIZE is as follows:
    LARGE_POOL_SIZE =  number_of_allocated_channels * 
                       (16 MB + ( 4 *  size_of_tape_buffer )
  • http://oracleinaction.com/tune-rman-i/