aaa authentication snmp local
snmp security no-security
user MORNITOR_USER password PASSWORD read-only all no auth
snmp community-map "COMUNITY_STRING" user MONITOR_USER enable
snmp community-map mode enable
snmp station IP_ADDRESS 161 v2 enable
write memory
copy running certified
Tuesday, October 16, 2018
Thursday, October 11, 2018
RPM package
RPM check package
rpm -q package-name
RPM List All package
rpm -qa
RPM update package
rpm -Uvh package-name
RPM remove package
rpm -evv package-name
RPM install package
rpm -ivh package-name
rpm -q package-name
RPM List All package
rpm -qa
RPM update package
rpm -Uvh package-name
RPM remove package
rpm -evv package-name
RPM install package
rpm -ivh package-name
Wednesday, October 10, 2018
Find Serial Number by SNMPWALK
find snmp OID:
snmpwalk -l noAuthNoPriv -v 1 -c COMUNICATION_STRING -On IP_ADDRESS | grep SERIALNUM
snmpwalk -l noAuthNoPriv -v3 IP_ADDRESS -u user -On
find serial by OID:
snmpwalk -l noAuthNoPriv -v 1 -c COMUNICATION_STRING -On IP_ADDRESS .1.3.6.1.2.1.47.1.1.1.1.11.1
snmpwalk -l noAuthNoPriv -v3 IP_ADDRESS -u user -On .1.3.6.1.2.1.47.1.1.1.1.11.67108867
find by network range:
for i in {1..20}; do echo ip = 192.168.1.$i Serial: ; snmpwalk -l noAuthNoPriv -v 1 -c COMUNICATION_STRING -On 192.168.1.$i .1.3.6.1.2.1.47.1.1.1.1.11.1 | awk '{print $4}'; done
for i in {1..20}; do echo ip = 192.168.2.$i Serial: ; snmpwalk -l noAuthNoPriv -v3 192.168.2.$i -u user -On .1.3.6.1.2.1.47.1.1.1.1.11.67108867 | awk '{print $4}'; done
ALCATEL 6400 Serial OID No. : .1.3.6.1.2.1.47.1.1.1.1.11
HUAWEI S5720 Serial OID No. : .1.3.6.1.2.1.47.1.1.1.1.11.67108867
snmpwalk -l noAuthNoPriv -v 1 -c COMUNICATION_STRING -On IP_ADDRESS | grep SERIALNUM
snmpwalk -l noAuthNoPriv -v3 IP_ADDRESS -u user -On
find serial by OID:
snmpwalk -l noAuthNoPriv -v 1 -c COMUNICATION_STRING -On IP_ADDRESS .1.3.6.1.2.1.47.1.1.1.1.11.1
snmpwalk -l noAuthNoPriv -v3 IP_ADDRESS -u user -On .1.3.6.1.2.1.47.1.1.1.1.11.67108867
find by network range:
for i in {1..20}; do echo ip = 192.168.1.$i Serial: ; snmpwalk -l noAuthNoPriv -v 1 -c COMUNICATION_STRING -On 192.168.1.$i .1.3.6.1.2.1.47.1.1.1.1.11.1 | awk '{print $4}'; done
for i in {1..20}; do echo ip = 192.168.2.$i Serial: ; snmpwalk -l noAuthNoPriv -v3 192.168.2.$i -u user -On .1.3.6.1.2.1.47.1.1.1.1.11.67108867 | awk '{print $4}'; done
ALCATEL 6400 Serial OID No. : .1.3.6.1.2.1.47.1.1.1.1.11
HUAWEI S5720 Serial OID No. : .1.3.6.1.2.1.47.1.1.1.1.11.67108867
Wednesday, September 12, 2018
How to find USER exec DDL on Oracle OBJECT using DBA_AUDIT_TRAIL
set:sqlplus parameter
SET LINESIZE 200
col OBJ_NAME format a20
col OS_USERNAME format a20
set:time format
alter session set nls_date_format='YYYY-MM-DD HH24:MI:SS';
exec sql:
select
USERNAME, OBJ_NAME, ACTION_NAME, TIMESTAMP,OS_USERNAME,SESSIONID
from
DBA_AUDIT_TRAIL
where
OBJ_NAME like 'OBJECT_NAME'
SET LINESIZE 200
col OBJ_NAME format a20
col OS_USERNAME format a20
set:time format
alter session set nls_date_format='YYYY-MM-DD HH24:MI:SS';
exec sql:
select
USERNAME, OBJ_NAME, ACTION_NAME, TIMESTAMP,OS_USERNAME,SESSIONID
from
DBA_AUDIT_TRAIL
where
OBJ_NAME like 'OBJECT_NAME'
Friday, June 8, 2018
Create SNMP v3 Huawei S5700 Switch noAUTH
:edit default acl allow any host
acl 2000
rule 1 permit source any
:create snmp agent
snmp-agent
snmp-agent acl 2000
snmp-agent local-engineid 800007DB035C546D0F51F0
snmp-agent sys-info contact email_address
snmp-agent sys-info location BUILDING_NAME
snmp-agent sys-info version all
snmp-agent group v3 GROUP_NAME noauthentication
snmp-agent usm-user v3 USERNAME
snmp-agent usm-user v3 USERNAME group GROUP_NAME
snmp-agent usm-user v3 USERNAME acl 2000
snmp-agent trap disable
:Test smpwalk
snmpwalk -l noAuthNoPriv -v3 xxx.xxx.xxx.xxx -u user
acl 2000
rule 1 permit source any
:create snmp agent
snmp-agent
snmp-agent acl 2000
snmp-agent local-engineid 800007DB035C546D0F51F0
snmp-agent sys-info contact email_address
snmp-agent sys-info location BUILDING_NAME
snmp-agent sys-info version all
snmp-agent group v3 GROUP_NAME noauthentication
snmp-agent usm-user v3 USERNAME
snmp-agent usm-user v3 USERNAME group GROUP_NAME
snmp-agent usm-user v3 USERNAME acl 2000
snmp-agent trap disable
:Test smpwalk
snmpwalk -l noAuthNoPriv -v3 xxx.xxx.xxx.xxx -u user
Wednesday, June 6, 2018
Change Cert mode to Working Mode Alcatel6400
Change Cert mode to Working Mode
copy certified working
reload working no rollback timeout
copy certified working
reload working no rollback timeout
REBOOT
Tuesday, June 5, 2018
Huawei S5700 Basic Command
:system view
system-view
or
sys
:show all config
dis current-configuration
:create vlan
vlan vlan_number
:show ip interface
display ip interface brief
:add ip route
ip route-static 0.0.0.0 0.0.0.0 Vlanif39 10.10.39.1
: create ip interface
interface vlanif vlan_num
-> ip address x.x.x.x 255.255.255.x
:add vlan member to interface
interface GigabitEthernet0/0/2
-> port link-type access
-> port default vlan 31
or
int gig0/0/2
-> port link-type access
-> port default vlan 31
:Create Port trunk
interface GigabitEthernet0/0/1
-> port link-type trunk
-> port trunk allow-pass vlan 31 39
or
int Gig0/0/1
-> port link-type trunk
-> port trunk allow-pass vlan 31 39
--add all vlan
interface GigabitEthernet0/0/1
-> port link-type trunk
-> port trunk allow-pass all
or
int Gig0/0/1
-> port link-type trunk
-> port trunk allow-pass vlan all
:create ssh remote
rsa local-key-pair create
user-interface vty 0 4
-> authentication-mode aaa
-> protocol inbound ssh
stelnet server enable
aaa
-> local-user USERNAME password cipher PASSWORD
-> local-user USERNAME privilege level 15
-> local-user USERNAME service-type ssh|telnet|terminal|http
ssh user USERNAME
ssh user USERNAME authentication-type password
ssh user USERNAME service-type stelnet|sftp|all
:enable ip Helper
ENABLED per VLAN interface
dhcp enable
Vlanif2100
dhcp select relay
dhcp relay server-ip DHCP_SERVER_IP_ADDRESS
Vlanif2101
dhcp select relay
dhcp relay server-ip DHCP_SERVER_IP_ADDRESS
:Huawei S5720 Switch AAA administrator password it gets the error: “the password has appeared in recent 5 times”
aaa
local-aaa-user password policy administrator
password history record number 0
:ospf
Loopback ip 10.9.9.9
int LoopBack 0
-> ip address 10.9.9.9 255.255.255.255
router id 10.9.9.9
ospf
area 0
network x.x.x.x x.x.x.x <------ wildcard
:disable spaning tree
stp disable
:exit
q
:save config
save
system-view
or
sys
:show all config
dis current-configuration
:create vlan
vlan vlan_number
:show ip interface
display ip interface brief
:add ip route
ip route-static 0.0.0.0 0.0.0.0 Vlanif39 10.10.39.1
: create ip interface
interface vlanif vlan_num
-> ip address x.x.x.x 255.255.255.x
:add vlan member to interface
interface GigabitEthernet0/0/2
-> port link-type access
-> port default vlan 31
or
int gig0/0/2
-> port link-type access
-> port default vlan 31
:Create Port trunk
interface GigabitEthernet0/0/1
-> port link-type trunk
-> port trunk allow-pass vlan 31 39
or
int Gig0/0/1
-> port link-type trunk
-> port trunk allow-pass vlan 31 39
--add all vlan
interface GigabitEthernet0/0/1
-> port link-type trunk
-> port trunk allow-pass all
or
int Gig0/0/1
-> port link-type trunk
-> port trunk allow-pass vlan all
:create ssh remote
rsa local-key-pair create
user-interface vty 0 4
-> authentication-mode aaa
-> protocol inbound ssh
stelnet server enable
aaa
-> local-user USERNAME password cipher PASSWORD
-> local-user USERNAME privilege level 15
-> local-user USERNAME service-type ssh|telnet|terminal|http
ssh user USERNAME
ssh user USERNAME authentication-type password
ssh user USERNAME service-type stelnet|sftp|all
:enable ip Helper
ENABLED per VLAN interface
dhcp enable
Vlanif2100
dhcp select relay
dhcp relay server-ip DHCP_SERVER_IP_ADDRESS
Vlanif2101
dhcp select relay
dhcp relay server-ip DHCP_SERVER_IP_ADDRESS
:Huawei S5720 Switch AAA administrator password it gets the error: “the password has appeared in recent 5 times”
aaa
local-aaa-user password policy administrator
password history record number 0
:ospf
Loopback ip 10.9.9.9
int LoopBack 0
-> ip address 10.9.9.9 255.255.255.255
router id 10.9.9.9
ospf
area 0
network x.x.x.x x.x.x.x <------ wildcard
:disable spaning tree
stp disable
:exit
q
:save config
save
Tuesday, April 10, 2018
Huawei S5720 IP helper Configuration
ENABLED by VLAN interface
#
dhcp enable
#
Vlanif2100
dhcp select relay
dhcp relay server-ip 10.100.100.10
#
Vlanif2101
dhcp select relay
dhcp relay server-ip 10.100.100.10
#
------------ END ------------
#
dhcp enable
#
Vlanif2100
dhcp select relay
dhcp relay server-ip 10.100.100.10
#
Vlanif2101
dhcp select relay
dhcp relay server-ip 10.100.100.10
#
------------ END ------------
Monday, March 19, 2018
Fix Error Ubuntu 'Host SMBus controller bus not enabled', 'no valid rapl domains found in package'
'Piix4_SMBus: 000:00:07.3: Host SMBus controller bus not enabled'
'no valid rapl domains found in package'
mount -o remount,rw /
vi /etc/modprobe.d/blacklist.conf
blacklist intel_rapl
blacklist i2c-piix4
'no valid rapl domains found in package'
mount -o remount,rw /
vi /etc/modprobe.d/blacklist.conf
blacklist intel_rapl
blacklist i2c-piix4
Tuesday, February 27, 2018
VMware PowerCLI : Search VMguest by MAC Address_IP Address
LIST IP VMware Service:
Get-VMHostNetworkAdapter | select ip, name, vmhost, portgroupname
Search VMguest by MAC Address:
Get-VM | Get-NetworkAdapter| Where-Object {$_.MacAddress -eq "00:50:56:8e:fd:4b"}
Search VMguets by IP Address
Get-VM | Where-Object {$_.guest.IPAddress[0] -eq "192.168.1.1"}
Get-VMHostNetworkAdapter | select ip, name, vmhost, portgroupname
Search VMguest by MAC Address:
Get-VM | Get-NetworkAdapter| Where-Object {$_.MacAddress -eq "00:50:56:8e:fd:4b"}
Search VMguets by IP Address
Get-VM | Where-Object {$_.guest.IPAddress[0] -eq "192.168.1.1"}
Monday, February 26, 2018
BAN ip list by iptables
BAN ip by iptables
-- Create banlist.txt
root@hosting:/home/hunzo/script# more banlist.txt
104.131.147.112
216.244.66.198
216.244.66.239
216.244.66.205
46.229.168.0/24
54.36.148.0/24
54.36.149.0/24
163.172.71.0/24
-- Check iptables rules
root@hosting:/home/hunzo/script# iptables -L -v -n
Chain INPUT (policy ACCEPT 322K packets, 19M bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 125K packets, 742M bytes)
pkts bytes target prot opt in out source destination
-- Create Script
root@hosting:/home/hunzo/script# ban=$(more banlist.txt)
root@hosting:/home/hunzo/script# for i in $ban; do echo iptables -A INPUT -s $i -j DROP ; done
iptables -A INPUT -s 104.131.147.112 -j DROP
iptables -A INPUT -s 216.244.66.198 -j DROP
iptables -A INPUT -s 216.244.66.239 -j DROP
iptables -A INPUT -s 216.244.66.205 -j DROP
iptables -A INPUT -s 46.229.168.0/24 -j DROP
iptables -A INPUT -s 54.36.148.0/24 -j DROP
iptables -A INPUT -s 54.36.149.0/24 -j DROP
iptables -A INPUT -s 163.172.71.0/24 -j DROP
-- exec script
root@hosting:/home/hunzo/script# for i in $ban; do iptables -A INPUT -s $i -j DROP ; done
-- check iptables rules
root@hosting:/home/hunzo/script# iptables -L -v -n
Chain INPUT (policy ACCEPT 322K packets, 19M bytes)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * * 104.131.147.112 0.0.0.0/0
0 0 DROP all -- * * 216.244.66.198 0.0.0.0/0
0 0 DROP all -- * * 216.244.66.239 0.0.0.0/0
0 0 DROP all -- * * 216.244.66.205 0.0.0.0/0
0 0 DROP all -- * * 46.229.168.0/24 0.0.0.0/0
0 0 DROP all -- * * 54.36.148.0/24 0.0.0.0/0
0 0 DROP all -- * * 54.36.149.0/24 0.0.0.0/0
0 0 DROP all -- * * 163.172.71.0/24 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 126K packets, 742M bytes)
pkts bytes target prot opt in out source destination
root@hosting:/home/hunzo/script#
@2018-02-26 11:15
root@hosting:/home/hunzo/script# iptables -L -v -n
Chain INPUT (policy ACCEPT 412K packets, 25M bytes)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * * 104.131.147.112 0.0.0.0/0
0 0 DROP all -- * * 216.244.66.198 0.0.0.0/0
0 0 DROP all -- * * 216.244.66.239 0.0.0.0/0
0 0 DROP all -- * * 216.244.66.205 0.0.0.0/0
3502 210K DROP all -- * * 46.229.168.0/24 0.0.0.0/0
309 18540 DROP all -- * * 54.36.148.0/24 0.0.0.0/0
120 7200 DROP all -- * * 54.36.149.0/24 0.0.0.0/0
0 0 DROP all -- * * 163.172.71.0/24 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 169K packets, 1024M bytes)
pkts bytes target prot opt in out source destinat
-- drop rules
'iptables -D INPUT -s 1.2.3.4 -j DROP'
1.2.3.4 = ip address
-- Create banlist.txt
root@hosting:/home/hunzo/script# more banlist.txt
104.131.147.112
216.244.66.198
216.244.66.239
216.244.66.205
46.229.168.0/24
54.36.148.0/24
54.36.149.0/24
163.172.71.0/24
-- Check iptables rules
root@hosting:/home/hunzo/script# iptables -L -v -n
Chain INPUT (policy ACCEPT 322K packets, 19M bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 125K packets, 742M bytes)
pkts bytes target prot opt in out source destination
-- Create Script
root@hosting:/home/hunzo/script# ban=$(more banlist.txt)
root@hosting:/home/hunzo/script# for i in $ban; do echo iptables -A INPUT -s $i -j DROP ; done
iptables -A INPUT -s 104.131.147.112 -j DROP
iptables -A INPUT -s 216.244.66.198 -j DROP
iptables -A INPUT -s 216.244.66.239 -j DROP
iptables -A INPUT -s 216.244.66.205 -j DROP
iptables -A INPUT -s 46.229.168.0/24 -j DROP
iptables -A INPUT -s 54.36.148.0/24 -j DROP
iptables -A INPUT -s 54.36.149.0/24 -j DROP
iptables -A INPUT -s 163.172.71.0/24 -j DROP
-- exec script
root@hosting:/home/hunzo/script# for i in $ban; do iptables -A INPUT -s $i -j DROP ; done
-- check iptables rules
root@hosting:/home/hunzo/script# iptables -L -v -n
Chain INPUT (policy ACCEPT 322K packets, 19M bytes)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * * 104.131.147.112 0.0.0.0/0
0 0 DROP all -- * * 216.244.66.198 0.0.0.0/0
0 0 DROP all -- * * 216.244.66.239 0.0.0.0/0
0 0 DROP all -- * * 216.244.66.205 0.0.0.0/0
0 0 DROP all -- * * 46.229.168.0/24 0.0.0.0/0
0 0 DROP all -- * * 54.36.148.0/24 0.0.0.0/0
0 0 DROP all -- * * 54.36.149.0/24 0.0.0.0/0
0 0 DROP all -- * * 163.172.71.0/24 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 126K packets, 742M bytes)
pkts bytes target prot opt in out source destination
root@hosting:/home/hunzo/script#
@2018-02-26 11:15
root@hosting:/home/hunzo/script# iptables -L -v -n
Chain INPUT (policy ACCEPT 412K packets, 25M bytes)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * * 104.131.147.112 0.0.0.0/0
0 0 DROP all -- * * 216.244.66.198 0.0.0.0/0
0 0 DROP all -- * * 216.244.66.239 0.0.0.0/0
0 0 DROP all -- * * 216.244.66.205 0.0.0.0/0
3502 210K DROP all -- * * 46.229.168.0/24 0.0.0.0/0
309 18540 DROP all -- * * 54.36.148.0/24 0.0.0.0/0
120 7200 DROP all -- * * 54.36.149.0/24 0.0.0.0/0
0 0 DROP all -- * * 163.172.71.0/24 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 169K packets, 1024M bytes)
pkts bytes target prot opt in out source destinat
-- drop rules
'iptables -D INPUT -s 1.2.3.4 -j DROP'
1.2.3.4 = ip address
Wednesday, February 21, 2018
Display big numbers in SQLPLUS
show num(width)
set num(width) 15
num(width) parameter (2-15)
SQL> show num
numwidth 10
SQL> l
1 select
2 current_scn
3 from
4* v$database
SQL> /
CURRENT_SCN
-----------
1.6139E+10
SQL> set num 15
SQL> l
1 select
2 current_scn
3 from
4* v$database
SQL> /
CURRENT_SCN
---------------
16138638611
SQL>
Friday, February 16, 2018
Clone Oracle Database 11G using RMAN backup SET
Script: migrate-ok.sh
#!/bin/bash
cd
. .bash_profile
export BACKUPPATH="/u04/move"
for i in MEIS
do
export DATAFILE="BACKUP_${i}_DATA_$(date '+%Y%m%d')"
echo $DATAFILE
export ARCHIVEDLOG="BACKUP_${i}_ARC_$(date '+%Y%m%d')"
echo $ARCHIVEDLOG
export CONTROLFILE="BACKUP_${i}_CTL_$(date '+%Y%m%d')"
echo $CONTROLFILE
export RMAN_LOG_FILE="BACKUP_${i}_$(date '+%Y%m%d').out"
echo $RMAN_LOG_FILE
echo Backup_data_file_path=$BACKUPPATH
export ORACLE_SID=$i
#EXPORT pfile
sqlplus '/ as sysdba' << EOF
CREATE pfile='${BACKUPPATH}/${i}/pfile-$i-$(date '+%Y%m%d').ora' from spfile;
EXIT;
EOF
#RMAN REPORT DATABASE INFORMATION
rman target / msglog ${BACKUPPATH}/${i}/DATABASE_${i}_info.txt <<EOF
run
{
REPORT SCHEMA;
}
EXIT;
EOF
#<<'test'
#RMAN BACKUPSET FOR Migration
rman target / msglog ${BACKUPPATH}/log/$RMAN_LOG_FILE <<EOF
run
{
ALLOCATE CHANNEL ch00 TYPE DISK;
ALLOCATE CHANNEL ch01 TYPE DISK;
ALLOCATE CHANNEL ch02 TYPE DISK;
ALLOCATE CHANNEL ch03 TYPE DISK;
BACKUP
TAG "${DATAFILE}"
FORMAT '${BACKUPPATH}/${i}/DATA_${i}_%s_%p_%t'
DATABASE;
sql 'alter system archive log current';
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
RELEASE CHANNEL ch02;
RELEASE CHANNEL ch03;
ALLOCATE CHANNEL ch00 TYPE DISK;
ALLOCATE CHANNEL ch01 TYPE DISK;
BACKUP
TAG "${ARCHIVEDLOG}"
FORMAT '${BACKUPPATH}/${i}/arc_${i}_%s_%p_%t'
ARCHIVELOG ALL ;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
ALLOCATE CHANNEL ch00 TYPE DISK;
BACKUP
TAG "${CONTROLFILE}"
FORMAT '${BACKUPPATH}/${i}/cntrl_${i}_%s_%p_%t'
CURRENT CONTROLFILE;
RELEASE CHANNEL ch00;
}
EXIT;
EOF
#test
echo $i
done
Scenario for clone target database to another Host
----------------------------------------------------------------
- exec: migrate-ok.sh
- scp backupset to target database
- create audit tail directory ex.mkdir /u01/app/oracle/admin/MEIS/adump
- create controlfile directory ex. mkdir /u02/MEIS/, mkdir /u01/app/oracle/fast_recovery_area/MEIS/
- create fast_recovery_area directory ex. mkdir /u01/app/oracle/fast_recovery_area
- start Oracle Instance from pfile ex. SQL> startup pfile='/u02/mig/pfile-MEIS-20160928.ora' nomount;
- restore controlfile from backupset ex. RMAN> restore controlfile from '/u02/mig/cntrl_MEIS_38_1_923742230';
- Clear Fast recovery Area.
- Catalog RMAN Backupset ex. RMAN> catalog start with '/u02/mig';
- Mount Datafile ex. RMAN> sql 'alter database mount';
- Restore datafile ex. RMAN > restore database;
- Recover database ex. RMAN > recover database;
- Open Database resetlogs ex. SQL> alter database open resetlogs;
- create orapwSID in $ORACLE_HOME ex. orapwd file=orapwMEIS password=oracle entries=3
- create oratab @/etc/oratab $ORACLE_SID:$ORACLE_HOME:<N|Y>: ex. MEIS:/u01/app/oracle/product/11.2.0.2/db_1:N
- change password SYS,SYSTEM,SYSMAN,DBSNMP to rebuild EM
- exec: emca -config dbcontrol db -repos recreate to rebuild Enterprise Management
#!/bin/bash
cd
. .bash_profile
export BACKUPPATH="/u04/move"
for i in MEIS
do
export DATAFILE="BACKUP_${i}_DATA_$(date '+%Y%m%d')"
echo $DATAFILE
export ARCHIVEDLOG="BACKUP_${i}_ARC_$(date '+%Y%m%d')"
echo $ARCHIVEDLOG
export CONTROLFILE="BACKUP_${i}_CTL_$(date '+%Y%m%d')"
echo $CONTROLFILE
export RMAN_LOG_FILE="BACKUP_${i}_$(date '+%Y%m%d').out"
echo $RMAN_LOG_FILE
echo Backup_data_file_path=$BACKUPPATH
export ORACLE_SID=$i
#EXPORT pfile
sqlplus '/ as sysdba' << EOF
CREATE pfile='${BACKUPPATH}/${i}/pfile-$i-$(date '+%Y%m%d').ora' from spfile;
EXIT;
EOF
#RMAN REPORT DATABASE INFORMATION
rman target / msglog ${BACKUPPATH}/${i}/DATABASE_${i}_info.txt <<EOF
run
{
REPORT SCHEMA;
}
EXIT;
EOF
#<<'test'
#RMAN BACKUPSET FOR Migration
rman target / msglog ${BACKUPPATH}/log/$RMAN_LOG_FILE <<EOF
run
{
ALLOCATE CHANNEL ch00 TYPE DISK;
ALLOCATE CHANNEL ch01 TYPE DISK;
ALLOCATE CHANNEL ch02 TYPE DISK;
ALLOCATE CHANNEL ch03 TYPE DISK;
BACKUP
TAG "${DATAFILE}"
FORMAT '${BACKUPPATH}/${i}/DATA_${i}_%s_%p_%t'
DATABASE;
sql 'alter system archive log current';
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
RELEASE CHANNEL ch02;
RELEASE CHANNEL ch03;
ALLOCATE CHANNEL ch00 TYPE DISK;
ALLOCATE CHANNEL ch01 TYPE DISK;
BACKUP
TAG "${ARCHIVEDLOG}"
FORMAT '${BACKUPPATH}/${i}/arc_${i}_%s_%p_%t'
ARCHIVELOG ALL ;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
ALLOCATE CHANNEL ch00 TYPE DISK;
BACKUP
TAG "${CONTROLFILE}"
FORMAT '${BACKUPPATH}/${i}/cntrl_${i}_%s_%p_%t'
CURRENT CONTROLFILE;
RELEASE CHANNEL ch00;
}
EXIT;
EOF
#test
echo $i
done
Scenario for clone target database to another Host
----------------------------------------------------------------
- exec: migrate-ok.sh
- scp backupset to target database
- create audit tail directory ex.mkdir /u01/app/oracle/admin/MEIS/adump
- create controlfile directory ex. mkdir /u02/MEIS/, mkdir /u01/app/oracle/fast_recovery_area/MEIS/
- create fast_recovery_area directory ex. mkdir /u01/app/oracle/fast_recovery_area
- start Oracle Instance from pfile ex. SQL> startup pfile='/u02/mig/pfile-MEIS-20160928.ora' nomount;
- restore controlfile from backupset ex. RMAN> restore controlfile from '/u02/mig/cntrl_MEIS_38_1_923742230';
- Clear Fast recovery Area.
- Catalog RMAN Backupset ex. RMAN> catalog start with '/u02/mig';
- Mount Datafile ex. RMAN> sql 'alter database mount';
- Restore datafile ex. RMAN > restore database;
- Recover database ex. RMAN > recover database;
- Open Database resetlogs ex. SQL> alter database open resetlogs;
- create orapwSID in $ORACLE_HOME ex. orapwd file=orapwMEIS password=oracle entries=3
- create oratab @/etc/oratab $ORACLE_SID:$ORACLE_HOME:<N|Y>: ex. MEIS:/u01/app/oracle/product/11.2.0.2/db_1:N
- change password SYS,SYSTEM,SYSMAN,DBSNMP to rebuild EM
- exec: emca -config dbcontrol db -repos recreate to rebuild Enterprise Management
Wednesday, January 31, 2018
Ban IP Address by IP Table
Ban IP Address by IP Table:
view Ban IP address:
iptables -L INPUT -v -n
Check Ban IP by IP address
iptables -L INPUT -v -n | grep "1.2.3.4"
Ban IP address:
iptables -A INPUT -s 97.74.24.174 -j DROP
Delete Ban by IP address
iptables -D INPUT -s 1.2.3.4 -j DROP
view Ban IP address:
iptables -L INPUT -v -n
Check Ban IP by IP address
iptables -L INPUT -v -n | grep "1.2.3.4"
Ban IP address:
iptables -A INPUT -s 97.74.24.174 -j DROP
Delete Ban by IP address
iptables -D INPUT -s 1.2.3.4 -j DROP
Monday, January 29, 2018
Purge, Flush or Delete Postfix Queue
Show Postfix mail Queue
postqueue -p or mailq
Delete mail msg by msg-id in Mail Queue
postsuper -d msg-id
Delete All mail msg in Mail Queue
postsuper -d ALL
postqueue -p or mailq
Delete mail msg by msg-id in Mail Queue
postsuper -d msg-id
Delete All mail msg in Mail Queue
postsuper -d ALL
Finding Files By Content in File
find . -name "configuration.php" |xargs grep --color '$user\|$password\|$db'
find . -name "*.php" |xargs grep 'base64_decode' | grep 'create_function'
find . -name "*.php" |xargs awk '/base64_decode/ && /create_function/'
find . -name "*.php" |xargs grep 'base64_decode' | grep 'create_function'
find . -name "*.php" |xargs awk '/base64_decode/ && /create_function/'
Saturday, January 27, 2018
Disable Directory list by .htaccess
Add Option in Apache2.conf
<Directory /var/www/html>
Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Create file .htaccess in /var/www/html
add Option :
Options -Indexes
<Directory /var/www/html>
Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Create file .htaccess in /var/www/html
add Option :
Options -Indexes
Wednesday, January 17, 2018
Check Application Run
:Check Schedule Run
SCHTASKS /Query /FO LIST /V >"%USERPROFILE%\Desktop\MyScheduledTasks.txt"
:Check Console Run export by Regedit
reg export "HKEY_CURRENT_USER\Console" "%USERPROFILE%\Desktop\MyConsoleSettings.txt" /y
:Check Local Machine Run export by Regedit
reg export "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "%USERPROFILE%\Desktop\MyLocalRunSettings.txt" /y
:Check Cuurent User Run export by Regedit
reg export "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "%USERPROFILE%\Desktop\MyUserRunSettings.txt" /y
:Check Config on StartUP
MSCONFIG
SCHTASKS /Query /FO LIST /V >"%USERPROFILE%\Desktop\MyScheduledTasks.txt"
:Check Console Run export by Regedit
reg export "HKEY_CURRENT_USER\Console" "%USERPROFILE%\Desktop\MyConsoleSettings.txt" /y
:Check Local Machine Run export by Regedit
reg export "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "%USERPROFILE%\Desktop\MyLocalRunSettings.txt" /y
:Check Cuurent User Run export by Regedit
reg export "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "%USERPROFILE%\Desktop\MyUserRunSettings.txt" /y
:Check Config on StartUP
MSCONFIG
Friday, January 12, 2018
Windows 10 Access FileShare On Windows 7
Windows 10 Access FileShare On Windows 7
1: gpedit
Computer configuration\administrative templates\network\Lanman Workstation
"Enable insecure guest logons"
2: regdit
Default Registry Value:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters]
"AllowInsecureGuestAuth"=dword:0
Configured Registry Value:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters]
"AllowInsecureGuestAuth"=dword:1
1: gpedit
Computer configuration\administrative templates\network\Lanman Workstation
"Enable insecure guest logons"
2: regdit
Default Registry Value:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters]
"AllowInsecureGuestAuth"=dword:0
Configured Registry Value:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters]
"AllowInsecureGuestAuth"=dword:1
Subscribe to:
Posts (Atom)
ALCATEL 6900
write memory copy running certified reload from working no rollback-timeout
-
SET LLDP System NAME: system name ALL-Uplink system location SIAM-FL11 SHOW LLDP Configure: show lldp config or show lldp local-syste...
-
grant execute on utl_http to wc grant execute on dbms_lock to wc; BEGIN DBMS_NETWORK_ACL_ADMIN.create_acl ( acl => ...
-
:system view system-view or sys :show all config dis current-configuration :create vlan vlan vlan_number :show ip interface ...