set head off
spool tmp.tmp
select 'Alter system kill session '''||sid||','||serial#||''';'
from v$session where username='USER_TO_KILL_IN_CAPS' ;
spoof off
@tmp.tmp
Saturday, March 12, 2016
How to kill all sessions for a given user in oracle
kill all sessions for a user
set head off
spool tmp.tmp
select 'Alter system kill session '''||sid||','||serial#||''';'
from v$session where username='USER_TO_KILL_IN_CAPS' ;
spoof off
@tmp.tmp
Sunday, July 27, 2014
awr snap id listings
column begin_interval_time format a25
column end_interval_time format a25
SELECT dbid, snap_id, begin_interval_time, end_interval_time from dba_hist_snapshot order by begin_interval_time;
http://www-03.ibm.com/systems/tools/databaseinsight/
column end_interval_time format a25
SELECT dbid, snap_id, begin_interval_time, end_interval_time from dba_hist_snapshot order by begin_interval_time;
http://www-03.ibm.com/systems/tools/databaseinsight/
Tuesday, July 22, 2014
Wifi connected but no internet on linux (ubuntu)
Hi
This is how i resolved ,
Please try the below commands as executed one by one followed by a reboot (sudo reboot)
This is how i resolved ,
Please try the below commands as executed one by one followed by a reboot (sudo reboot)
sudo apt-get install linux-firmware-nonfree sudo apt-get remove --purge bcmwl-kernel-source sudo rm /etc/modprobe.d/blacklist-bcm43.conf sudo rm /etc/modprobe.d/broadcom-sta-common.conf sudo rm /etc/modprobe.d/broadcom-sta-dkms.conf sudo sed -i "s/blacklist b43/#blacklist b43/g" $(egrep -lo 'blacklist b43' /etc/modprobe.d/*) sudo sed -i "s/blacklist ssb/#blacklist ssb/g" $(egrep -lo 'blacklist ssb' /etc/modprobe.d/*) sudo sed -i "s/blacklist bcma/#blacklist bcma/g" $(egrep -lo 'blacklist bcma' /etc/modprobe.d/*)
Thanks
Thursday, May 1, 2014
Oracle environmental variable setup (Unix)
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1
export ORACLE_SID=rd2
export ORAENV_ASK=NO
export PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/bin:/$ORACLE_HOME/bin:/$ORACLE_HOME/OPatch
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/12.1.0/grid/bin
export ORACLE_GRID=rd2
export ORAENV_ASK=NO
export PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/bin:/$ORACLE_HOME/bin:/$ORACLE_HOME/OPatch
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1
export ORACLE_SID=rd2
export ORAENV_ASK=NO
export PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/bin:/$ORACLE_HOME/bin:/$ORACLE_HOME/OPatch
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/12.1.0/grid/bin
export ORACLE_GRID=rd2
export ORAENV_ASK=NO
export PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/bin:/$ORACLE_HOME/bin:/$ORACLE_HOME/OPatch
Adding addtional disk to the existing disk group (Virtual Box)
1. Check the existing
ls /dev/sd*
brw-rw---- 1 root disk 8, 2 Apr 12 12:15 sda2
brw-rw---- 1 root disk 8, 32 Apr 12 12:15 sdc
brw-rw---- 1 root disk 8, 48 Apr 12 12:15 sdd
brw-rw---- 1 root disk 8, 1 Apr 12 12:15 sda1
brw-rw---- 1 root disk 8, 0 Apr 12 12:16 sda
brw-rw---- 1 root disk 8, 16 Apr 12 12:16 sdb
brw-rw---- 1 root disk 8, 64 Apr 12 12:16 sde
2. Shutdown the machine
3. create a new storage disk (new fixed size )
4. modify as shareable
5. Confirm that the new /dev/sd* has been attached sucessfully to the server
6. fdisk /dev/sdf -- follow the normal procedure as "n" "p" "1" return retun "w" cross reffer the commands and confirm the new disk is showing in /dev/sd*
7./sbin/scsi_id -g -u -d /dev/sdf (sdf is the newly added disk)
8.Configure udev vi /etc/udev/rules.d/99-oracle-asmdevices.rules
9. restart the machine it should have added now !!
Now Discover the asm disks from asm instance, so that it can be added to an existing disk group
column name format a30
column value format a20
SELECT group_number, name, value
FROM v$asm_attribute
ORDER BY group_number, name;
GROUP_NUMBER NAME
SQL> 2 3
GROUP_NUMBER NAME VALUE
------------ ------------------------------ --------------------
1 au_size 1048576
1 content.check FALSE
1 content.type data
1 disk_repair_time 3.6h
1 failgroup_repair_time 24.0h
1 idp.boundary auto
1 idp.type dynamic
1 phys_meta_replicated true
1 sector_size 512
1 thin_provisioned FALSE
10 rows selected.
---------------------------------------------------------------------------------------
column path format a20
set lines 132
set pages 50
select path, group_number group_#, disk_number disk_#, mount_status,
header_status, state, total_mb, free_mb
from v$asm_disk
order by group_number;SQL> SQL> SQL> 2 3 4
PATH GROUP_# DISK_# MOUNT_S HEADER_STATU STATE TOTAL_MB FREE_MB
-------------------- ---------- ---------- ------- ------------ -------- ---------- ----------
/dev/asm-disk5 0 0 CLOSED CANDIDATE NORMAL 0 0
/dev/asm-disk4 1 3 CACHED MEMBER NORMAL 5114 2447
/dev/asm-disk1 1 0 CACHED MEMBER NORMAL 5114 2402
/dev/asm-disk3 1 2 CACHED MEMBER NORMAL 5114 2407
/dev/asm-disk2 1 1 CACHED MEMBER NORMAL 5114 2410
--------------------------------------------------------------------------------------------------
login to asm instance and add the new added disk to the existing disk group
alter diskgroup data add disk '/dev/asm-disk5';
And the new disk added sucessfully and visible as disk5 in the disk group.
column path format a20
set lines 132
set pages 50
select path, group_number group_#, disk_number disk_#, mount_status,
header_status, state, total_mb, free_mb
from v$asm_disk
order by group_numberSQL> SQL> SQL> 2 3 4
5 /
PATH GROUP_# DISK_# MOUNT_S HEADER_STATU STATE TOTAL_MB FREE_MB
-------------------- ---------- ---------- ------- ------------ -------- ---------- ----------
/dev/asm-disk3 1 2 CACHED MEMBER NORMAL 5114 2737
/dev/asm-disk5 1 4 CACHED MEMBER NORMAL 12284 10942
/dev/asm-disk1 1 0 CACHED MEMBER NORMAL 5114 2735
/dev/asm-disk2 1 1 CACHED MEMBER NORMAL 5114 2742
/dev/asm-disk4 1 3 CACHED MEMBER NORMAL 5114 2771
The below query can give us the detailed look on the asm disks/diskgroup etc....
ls /dev/sd*
brw-rw---- 1 root disk 8, 2 Apr 12 12:15 sda2
brw-rw---- 1 root disk 8, 32 Apr 12 12:15 sdc
brw-rw---- 1 root disk 8, 48 Apr 12 12:15 sdd
brw-rw---- 1 root disk 8, 1 Apr 12 12:15 sda1
brw-rw---- 1 root disk 8, 0 Apr 12 12:16 sda
brw-rw---- 1 root disk 8, 16 Apr 12 12:16 sdb
brw-rw---- 1 root disk 8, 64 Apr 12 12:16 sde
2. Shutdown the machine
3. create a new storage disk (new fixed size )
4. modify as shareable
5. Confirm that the new /dev/sd* has been attached sucessfully to the server
6. fdisk /dev/sdf -- follow the normal procedure as "n" "p" "1" return retun "w" cross reffer the commands and confirm the new disk is showing in /dev/sd*
7./sbin/scsi_id -g -u -d /dev/sdf (sdf is the newly added disk)
8.Configure udev vi /etc/udev/rules.d/99-oracle-asmdevices.rules
9. restart the machine it should have added now !!
Now Discover the asm disks from asm instance, so that it can be added to an existing disk group
column name format a30
column value format a20
SELECT group_number, name, value
FROM v$asm_attribute
ORDER BY group_number, name;
GROUP_NUMBER NAME
SQL> 2 3
GROUP_NUMBER NAME VALUE
------------ ------------------------------ --------------------
1 au_size 1048576
1 content.check FALSE
1 content.type data
1 disk_repair_time 3.6h
1 failgroup_repair_time 24.0h
1 idp.boundary auto
1 idp.type dynamic
1 phys_meta_replicated true
1 sector_size 512
1 thin_provisioned FALSE
10 rows selected.
---------------------------------------------------------------------------------------
column path format a20
set lines 132
set pages 50
select path, group_number group_#, disk_number disk_#, mount_status,
header_status, state, total_mb, free_mb
from v$asm_disk
order by group_number;SQL> SQL> SQL> 2 3 4
PATH GROUP_# DISK_# MOUNT_S HEADER_STATU STATE TOTAL_MB FREE_MB
-------------------- ---------- ---------- ------- ------------ -------- ---------- ----------
/dev/asm-disk5 0 0 CLOSED CANDIDATE NORMAL 0 0
/dev/asm-disk4 1 3 CACHED MEMBER NORMAL 5114 2447
/dev/asm-disk1 1 0 CACHED MEMBER NORMAL 5114 2402
/dev/asm-disk3 1 2 CACHED MEMBER NORMAL 5114 2407
/dev/asm-disk2 1 1 CACHED MEMBER NORMAL 5114 2410
--------------------------------------------------------------------------------------------------
login to asm instance and add the new added disk to the existing disk group
alter diskgroup data add disk '/dev/asm-disk5';
And the new disk added sucessfully and visible as disk5 in the disk group.
column path format a20
set lines 132
set pages 50
select path, group_number group_#, disk_number disk_#, mount_status,
header_status, state, total_mb, free_mb
from v$asm_disk
order by group_numberSQL> SQL> SQL> 2 3 4
5 /
PATH GROUP_# DISK_# MOUNT_S HEADER_STATU STATE TOTAL_MB FREE_MB
-------------------- ---------- ---------- ------- ------------ -------- ---------- ----------
/dev/asm-disk3 1 2 CACHED MEMBER NORMAL 5114 2737
/dev/asm-disk5 1 4 CACHED MEMBER NORMAL 12284 10942
/dev/asm-disk1 1 0 CACHED MEMBER NORMAL 5114 2735
/dev/asm-disk2 1 1 CACHED MEMBER NORMAL 5114 2742
/dev/asm-disk4 1 3 CACHED MEMBER NORMAL 5114 2771
The below query can give us the detailed look on the asm disks/diskgroup etc....
REM ASM views:REM VIEW |ASM INSTANCE |DB INSTANCEREM ----------------------------------------------------------------------------------------------------------REM V$ASM_DISKGROUP |Describes a disk group (number, name, size |Contains one row for every open ASMREM |related info, state, and redundancy type) |disk in the DB instance.REM V$ASM_CLIENT |Identifies databases using disk groups |Contains no rows.REM |managed by the ASM instance. |REM V$ASM_DISK |Contains one row for every disk discovered |Contains rows only for disks in theREM |by the ASM instance, including disks that |disk groups in use by that DB instance.REM |are not part of any disk group. |REM V$ASM_FILE |Contains one row for every ASM file in every |Contains rows only for files that areREM |disk group mounted by the ASM instance. |currently open in the DB instance.REM V$ASM_TEMPLATE |Contains one row for every template present in |Contains no rows.REM |every disk group mounted by the ASM instance. |REM V$ASM_ALIAS |Contains one row for every alias present in |Contains no rows.REM |every disk group mounted by the ASM instance. |REM v$ASM_OPERATION |Contains one row for every active ASM long |Contains no rows.REM |running operation executing in the ASM instance. |set wrap offset lines 155 pages 9999col "Group Name" for a6 Head "Group|Name"col "Disk Name" for a10col "State" for a10col "Type" for a10 Head "Diskgroup|Redundancy"col "Total GB" for 9,990 Head "Total|GB"col "Free GB" for 9,990 Head "Free|GB"col "Imbalance" for 99.9 Head "Percent|Imbalance"col "Variance" for 99.9 Head "Percent|Disk Size|Variance"col "MinFree" for 99.9 Head "Minimum|Percent|Free"col "MaxFree" for 99.9 Head "Maximum|Percent|Free"col "DiskCnt" for 9999 Head "Disk|Count"promptprompt ASM Disk Groupsprompt ===============SELECT g.group_number "Group", g.name "Group Name", g.state "State", g.type "Type", g.total_mb/1024 "Total GB", g.free_mb/1024 "Free GB", 100*(max((d.total_mb-d.free_mb)/d.total_mb)-min((d.total_mb-d.free_mb)/d.total_mb))/max((d.total_mb-d.free_mb)/d.total_mb) "Imbalance", 100*(max(d.total_mb)-min(d.total_mb))/max(d.total_mb) "Variance", 100*(min(d.free_mb/d.total_mb)) "MinFree", 100*(max(d.free_mb/d.total_mb)) "MaxFree", count(*) "DiskCnt"FROM v$asm_disk d, v$asm_diskgroup gWHERE d.group_number = g.group_number andd.group_number <> 0 andd.state = 'NORMAL' andd.mount_status = 'CACHED'GROUP BY g.group_number, g.name, g.state, g.type, g.total_mb, g.free_mbORDER BY 1;prompt ASM Disks In Useprompt ================col "Group" for 999col "Disk" for 999col "Header" for a9col "Mode" for a8col "State" for a8col "Created" for a10 Head "Added To|Diskgroup"--col "Redundancy" for a10--col "Failure Group" for a10 Head "Failure|Group"col "Path" for a19--col "ReadTime" for 999999990 Head "Read Time|seconds"--col "WriteTime" for 999999990 Head "Write Time|seconds"--col "BytesRead" for 999990.00 Head "GigaBytes|Read"--col "BytesWrite" for 999990.00 Head "GigaBytes|Written"col "SecsPerRead" for 9.000 Head "Seconds|PerRead"col "SecsPerWrite" for 9.000 Head "Seconds|PerWrite"select group_number "Group", disk_number "Disk", header_status "Header", mode_status "Mode", state "State", create_date "Created"--, redundancy "Redundancy", total_mb/1024 "Total GB", free_mb/1024 "Free GB", name "Disk Name"--, failgroup "Failure Group", path "Path"--, read_time "ReadTime"--, write_time "WriteTime"--, bytes_read/1073741824 "BytesRead"--, bytes_written/1073741824 "BytesWrite", read_time/reads "SecsPerRead", write_time/writes "SecsPerWrite"from v$asm_disk_statwhere header_status not in ('FORMER','CANDIDATE')order by group_number, disk_number/Prompt File Types in DiskgroupsPrompt ========================col "File Type" for a16col "Block Size" for a5 Head "Block|Size"col "Gb" for 9990.00col "Files" for 99990break on "Group Name" skip 1 nodupselect g.name "Group Name", f.TYPE "File Type", f.BLOCK_SIZE/1024||'k' "Block Size", f.STRIPED, count(*) "Files", round(sum(f.BYTES)/(1024*1024*1024),2) "Gb"from v$asm_file f,v$asm_diskgroup gwhere f.group_number=g.group_numbergroup by g.name,f.TYPE,f.BLOCK_SIZE,f.STRIPEDorder by 1,2;clear breakprompt Instances currently accessing these diskgroupsprompt ==============================================col "Instance" form a8select c.group_number "Group", g.name "Group Name", c.instance_name "Instance"from v$asm_client c, v$asm_diskgroup gwhere g.group_number=c.group_number/prompt Free ASM disks and their pathsprompt ==============================col "Disk Size" form a9select header_status "Header", mode_status "Mode", path "Path", lpad(round(os_mb/1024),7)||'Gb' "Disk Size"from v$asm_diskwhere header_status in ('FORMER','CANDIDATE')order by path/prompt Current ASM disk operationsprompt ===========================select *from v$asm_operation/ |
Subscribe to:
Posts (Atom)
How to Trouble shoot Logfile_sync wait event
First Identify and break down LGWR wait events. Query wait events for LGWR. In this instance LGWR sid is 3 (and usually it is). select s...
-
Refference with the document How to Clean Up Duplicate Objects Owned by SYS and SYSTEM Schema [ID 1030426.6] Hi Had faced an issue where ...
-
Login to the first node column is_recovery_dest_file format a25 column name format a60 set linesize 160 select status, name, is_recover...
-
SQL> SELECT LOG_MODE FROM SYS.V$DATABASE; LOG_MODE ------------ NOARCHIVELOG show parameter archive will tell u the archive...