Saturday, December 19, 2015

DUPLICATE Oracle database and set new SID from RMAN Full backup

@target

- full backup rman (controlfile,datafile,archivelog)

- create pfile='initNEW_SID.ora' from spfile;
- change current_instance_name to new_instance_name in pfile
- add *.LOG_FILE_NAME_CONVERT and *.DB_FILE_NAME_CONVERT to last line in pfile

exp:
*.LOG_FILE_NAME_CONVERT='/u01/old_log_file_path','/u02/new_log_file_path'
*.DB_FILE_NAME_CONVERT='/u01/old_data_file_path','/u02/new_data_file_path'


**** for Multiple path Oracle datafile
*.LOG_FILE_NAME_CONVERT='/data1/oradata/ORCLG','/data1/oradata/DUPDB',
                    '/data2/oradata/ORCL','/data2/oradata/DUPDB',
                    '/data3/oradata/ORCL','/data3/oradata/DUPDB'



*.DB_FILE_NAME_CONVERT='/data1/oradata/ORCL','/data1/oradata/DUPDB',
                    '/data2/oradata/ORCL','/data2/oradata/DUPDB',
                    '/data3/oradata/ORCL','/data3/oradata/DUPDB',
                    '/data4/oradata/ORCL','/data4/oradata/DUPDB',
                    '/data5/oradata/ORCL','/data5/oradata/DUPDB',
                    '/data6/oradata/ORCL','/data6/oradata/DUPDB'

- create folder datafile and logfile for new_instance_name

@auxiliary

- startup pfile='initNEW_SID.ora' nomount;
- connect to RMAN by command 'rman auxiliary /'



duplicate database to "newSID" backup location '/backup_rman/oldSID';


trick-2:
create auxiliary by dbca and set new datafile + log file path for newSID

- connect rman as auxiliary  using command

duplicate database to "newSID" nofilenamecheck  backup location '/backup_rman/oldSID';

Wednesday, December 16, 2015

Enabling Oracle HTTP Server to Run as Root for Ports Set to Less Than 1024 (UNIX Only)

Go to $ORACLE_HOME/ohs/bin
chown root .apachectl
chmod 6750 .apachectl

check $ORACLE_INSTANCE/config/OHS/ohs1/httpd.conf
section:
User oracle
Group group_to_start_apache

set port 
section:
Listen < 1024

Wednesday, November 25, 2015

SSH Login without Password : Solaris 10, Linux

:ON Solaris 10

ssh-keygen -t rsa
- id_rsa
- id_rsa.pub
@ ~/.ssh
copy id_rsa.pub to remoteHost

scp /export/home/test/.ssh/id_rsa.pub testuser@remotehost:/home/testuser/.ssh

login to remotehost
cat ~/.ssh/id_rsa.pub >> authorized_keys


@server

ssh testuser@remotehost
scp xxx.file testuser@remotehost

:ON LINUX Server

ssh-keygen

ssh-copy-id user@remotehost

ssh user@remotehost

Thursday, November 12, 2015

Step by step to add disk to LVM and resize lv


ADD Disk to OS (Linux)

- fdisk -l /dev/sdx and create new partition

- pvcreate /dev/sdx1

- vgdisplay ; list volume group name


CREATE VOLUME

- vgcreate volumn_name /dev/sdd


EXTEND VOLUME

- vgextend vol_group_name /dev/sdx1

CREATE LOGICAL VOLUME

- lvcreate -l 20m -n logical_vol vol_group

- lvcreate -l 100%FREE -n logical_vol vol_group

- lvdisplay ; list logcal volume group name

EXTEND LOGICAL VOLUME

- lvextend -l +100%FREE /dev/vol_group_name/logical_volume
 or
- lvextend /dev/vol_group_name  /dev/sdx1

RESIZE LVM

EXT:
- resize2fs /dev/log_vol_group_name

XFS:
- xfs_growfs /MOUNT_POINT

EXT4:
- resize4fs /dev/log_vol_group_name

Tuesday, November 3, 2015

NFS Server

create same userID ad groupID between NFS-Server and NFS-Client
for manage Permission

iSCSI on Solaris 10 x86

-Check iSCSI Service

svcs -a | grep iscsi
svcadm enable svc:/network/iscsi_initiator

-iSCSI setup initiator

iscsiadm add discovery-address 192.168.1.10:3260
iscsiadm modify initiator-node -a CHAP
iscsiadm modify initiator-node -H username
iscsiadm modify initiator-node -C
(specify CHAP password)

-iSCSI send target for Enable

iscsiadm modify discovery --sendtargets enable <--- for enable target
iscsiadm modify discovery --sendtargets disable <--- for disable target

iscsiadm list target
iscsiadm add static-config iqn.2015-11.com.wdc:wdsentinel-01-oracle-rman,192.168.1.10:3260
devfsadm -c iscsi

Sunday, October 11, 2015

remote orphaned user from office365

Power shell
-logon to office365

$credential = Get-Credential
Import-Module MsOnline
Connect-MsolService -Credential $credential
Get-MsolAccountSku

-remove command   

Remove-MsolUser -UserPrincipalName <account id>
Remove-MsolUser -UserPrincipalName <account id> -RemoveFromRecycleBin

Tuesday, October 6, 2015

plugin integration client vsphere 6.0 on Firefox

about:config

security.ssl3.dhe_rsa_aes_128.sha
security.ssl3.dhe_rsa_aes_256_sha

toggle to False

Friday, September 25, 2015

ADD Swap to ORACLE LINUX

Add Swap file on ORACLE LINUX

fdisk /dev/sdb

create partition

-create swap file
mkswap /dev/sdb1

-add swap
swapon -a /dev/sdb1


-add in /etc/fstab

/dev/sdb1    swap swap    deafults 0 0

Thursday, September 10, 2015

ORACLE ASM not start (ORA-01078, ORA-29701)

ORACLE ASM not start

SQL> startup
ORA-01078: failure in processing system parameters
ORA-29701: unable to connect to Cluster Synchronization Service


(+ASM) /export/home/oracle $ crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    devdb01
ora.FRA.dg     ora....up.type ONLINE    ONLINE    devdb01
ora....ER.lsnr ora....er.type ONLINE    ONLINE    devdb01
ora.asm        ora.asm.type   ONLINE    ONLINE    devdb01
ora.cssd       ora.cssd.type  ONLINE    ONLINE    devdb01
ora.diskmon    ora....on.type ONLINE    ONLINE    devdb01
ora.evmd       ora.evm.type   ONLINE    ONLINE    devdb01
ora.meis.db    ora....se.type ONLINE    ONLINE    devdb01
ora.ons        ora.ons.type   OFFLINE   OFFLINE


ENABLE HAS

(+ASM) /export/home/oracle $ crsctl enable has
CRS-4622: Oracle High Availability Services autostart is enabled.

(+ASM) /export/home/oracle $ crsctl start has
CRS-4123: Oracle High Availability Services has been started.



Connect ORACLE +ASM instance

sqlplus / as sysasm
startup

esxi update patch error ( thumbprint, not trusted)

Error:
Connect to esxi.mydomain.com failed. Server SHA-1 thumbprint 5D:01:06:63:55:9D:DF:FE:38:81:6E:2C:FA:71:BC:63:82:C5:16:51 <not trusted>

- install VMware Vsphere CLI


C:\Program Files (x86)\VMware\VMware vSphere CLI\Perl\apps\general>
credstore_admin.pl add --server esxi.mydomain.com --username my_user --password my_password
credstore_admin.pl add --server esxi.mydomain.com --thumbprint 5D:01:06:63:55:9D:DF:FE:38:81:6E:2C:FA:71:BC:63:82:C5:16:51

C:\Program Files (x86)\VMware\VMware vSphere CLI\bin>
esxcli --server esxi.mydomain.com --username my_user software vib update --depot=/vmfs/volumes/Data_Store_name/Path_file/ESXi550-201412001.zip

Tuesday, September 1, 2015

VMware PowerCLI export ova

#Set ENV
$VM = Get-Content .\vmhost_list.txt
$BackupvCenter = "vCenter.domain.local"
$BackupHost = "esxi-01.Domain.local"
$backupDate = Get-Date -Format yyyyMMdd
$backupDatastore = "vmd-01:LocalStorage"

Connect-VIServer -Server $BackupvCenter -User user_name@domain.local -Password user_password

#Dynamically create a folder
$BackupDir = "E:\vMware-backup\$BackupDate"
mkdir $BackupDir

foreach ($line in $VM) {

    Get-VM -Server $BackupvCenter  | where { $_.PowerState -like 'PoweredOn' -and $_.name -like $line } | select name, vmhost, usedspacegb

    $VM_TMP = $line+'-ova_backup-'+$backupDate

#Clone New VM
New-VM -Name $VM_TMP -VM $line -VMHost $BackupHost -Datastore $backupDatastore

#Export OVA file
Export-VApp -Destination $BackupDir -VM $VM_TMP -Format OVA

#Remove-VM $TMP -DeleteFromDisk -Confirm:$true
}

Tuesday, August 18, 2015

Microsoft Office365 PowerShell

MSol Connect
===========
Import-Module MSOnline
Connect-MsolService -Credential $cred
Get-MsolAccountSku

#ADD User No License on Office365

$upn = Get-Content .\upn-nolic.txt

foreach ($line in $upn) {

#ADD by sAMAccountName

#Get-ADUser -SearchBase "dc=domain,dc=local" -Filter { samaccountname -eq $line } |Select-Object DistinguishedName, GivenName, Surname, UserPrincipalName
#Set-MsolUserLicense -UserPrincipalName $line@domain.com -AddLicenses domain365:STANDARDWOFFPACK_FACULTY
#Set-MsolUser -UserPrincipalName $line@domain.com -UsageLocation "TH"


#ADD by UserPrincipalName

#Get-ADUser -SearchBase "dc=domain,dc=local" -Filter { UserPrincipalName -eq $line } |Select-Object DistinguishedName, GivenName, Surname, UserPrincipalName
#Set-MsolUser -UserPrincipalName $line -UsageLocation "TH"
#Set-MsolUserLicense -UserPrincipalName $line -AddLicenses domain365:STANDARDWOFFPACK_FACULTY

#Get-MsolUser -DomainName domain.com -SearchString $line | Select Displayname, UserPrincipalName, Licenses, LastDirSyncTime, UsageLocation
   
}


ActiveDirectory Connect
==================
$UN="test."
Get-ADUser -SearchBase "dc=domain,dc=local" -Filter { samaccountname -eq $UN } | Select-Object DistinguishedName, GivenName, Surname, UserPrincipalName
Get-ADUser $UN -Properties *
Get-ADUser $UN -Properties * | Select-Object UserPrincipalName
Get-ADUser -SearchBase "ou=itc,ou=nida,dc=domain,dc=local" -Filter { samaccountname -eq $UN } -Properties * | Select-Object UserPrincipalName, optionalEmail, mail,DistinguishedName
Get-ADUser -SearchBase "ou=itc,ou=users,dc=domain,dc=local" -Filter * -Properties * | Select-Object SamaccountName, mail, optionalEmail


Set Attribute ADuser
===============
Get-ADUser -SearchBase "ou=subouname,ou=ouname,dc=domain,dc=local" -Properties * -Filter {samaccountname -like "su*"} | Set-ADUser -MobilePhone " "

Friday, August 14, 2015

Oracle AMM

memory_max_target >= memory_target>=sga_max_size>=sga_target

example:

ALTER SYSTEM SET memory_max_target='2147483648' SCOPE=SPFILE;
ALTER SYSTEM SET memory_target='2147483648' SCOPE=SPFILE;
ALTER SYSTEM SET db_cache_size='4194304' SCOPE=SPFILE;
ALTER SYSTEM SET java_pool_size='0' SCOPE=SPFILE;
ALTER SYSTEM SET pga_aggregate_target='0' SCOPE=SPFILE;
ALTER SYSTEM SET shared_pool_size='0' SCOPE=SPFILE;
ALTER SYSTEM SET sga_max_size='2147483648' SCOPE=SPFILE;
ALTER SYSTEM SET sga_target='0' SCOPE=SPFILE;

 '0 = auto'

Thursday, July 23, 2015

Decommissioning the vCenter Server or a Platform Services Controller

shell.set –enabled True
shell

cd /usr/lib/vmware-vmdir/bin

run

./vdcrepadmin -f showpartners -h vc-psc.example.com -u administrator -w password


./vdcrepadmin -f showservers -h vc-psc.example.com -u administrator -w password


./vdcleavefed -h vc02.nida.local -u administrator -w password


cmsso-util unregister --node-pnid vcenter.example.com --username administrator@vsphere.local --passwd password

Wednesday, July 22, 2015

Privilege on Oracle Database for vCenter 6.0

Create ROLEs

create role vc_admin_role;

create user vcenter identified by oracle account unlock;

grant resource to vcenter;

grant connect to vcenter;

grant connect to vc_admin_role;

grant resource to vc_admin_role;

grant create view to vc_admin_role;

grant create sequence to vc_admin_role;

grant create table to vc_admin_role;

grant create materialized view to vc_admin_role;

grant execute on dbms_lock to vc_admin_role;

grant select on dba_lock TO vc_admin_role;

grant execute on dbms_job to vc_admin_role;

grant select on dba_tablespaces to vc_admin_role;

grant select on dba_temp_files to vc_admin_role;

grant select on dba_data_files to vc_admin_role;

grant unlimited tablespace to vc_admin_role;

grant select on v_$session TO vc_admin_role;

grant select on v_$system_event TO vc_admin_role;

grant select on v_$sysmetric_history TO vc_admin_role;

grant select on v_$sysstat TO vc_admin_role;

grant select on dba_data_files TO vc_admin_role;

grant select on v_$loghist TO vc_admin_role;

Tuesday, July 21, 2015

Duplicate oracle database same host and change Instance NAME

Instance DUBDB


FULL Backup on Target first

@create local tns tnsname.ora

DUPDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain )(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = DUPDB)
    )
  )

@create service listener.ora

SID_LIST_LISTENER =
  (SID_LIST =

    (SID_DESC =
      (SID_NAME = DUPDB)
      (ORACLE_HOME = /u01/oracle/product/11.2.0.2/dbhome_1)
      (GLOBAL_DBNAME = DUPDB)
    )
  )


@create pfile for dupplicate database
add line

ORCL.__db_cache_size=260046848
ORCL.__java_pool_size=4194304
ORCL.__large_pool_size=4194304
ORCL.__oracle_base='/u01/oracle'#ORACLE_BASE set from environment
ORCL.__pga_aggregate_target=373293056
ORCL.__sga_target=700448768
ORCL.__shared_io_pool_size=0
ORCL.__shared_pool_size=411041792
ORCL.__streams_pool_size=8388608
*.audit_file_dest='/u01/oracle/admin/DUPDB/adump'<---New audit file
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u02/DUPDB/control01.ctl','/u02/DUPDB/control02.ctl'<---new path controlfile
*.db_block_size=8192
*.db_domain=''
*.db_name='DUPDB'<---New Instance DB
*.db_recovery_file_dest='/u02/DUPDB/f_recovery'<---New fast_recovery_area
*.db_recovery_file_dest_size=4259315712
*.diagnostic_dest='/u01/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
*.memory_target=1073741824
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
*.LOG_FILE_NAME_CONVERT='/u02/oradata/ORCL/','/u02/DUPDB/'<---add for convert datafile from original path to new path
*.DB_FILE_NAME_CONVERT='/u02/oradata/ORCL/redo','/u02/DUPDB/redo'<---add for convert redolog from original path to new path


**** for Multiple path Oracle datafile
*.LOG_FILE_NAME_CONVERT='/data1/oradata/ORCLG','/data1/oradata/DUPDB',
            '/data2/oradata/ORCL','/data2/oradata/DUPDB',
            '/data3/oradata/ORCL','/data3/oradata/DUPDB'



*.DB_FILE_NAME_CONVERT='/data1/oradata/ORCL','/data1/oradata/DUPDB',
            '/data2/oradata/ORCL','/data2/oradata/DUPDB',
            '/data3/oradata/ORCL','/data3/oradata/DUPDB',
            '/data4/oradata/ORCL','/data4/oradata/DUPDB',
            '/data5/oradata/ORCL','/data5/oradata/DUPDB',
            '/data6/oradata/ORCL','/data6/oradata/DUPDB'


@create oracle password file $ORACLE_HOME/dbs
orapwd file='orapwINSTANCE_NAME' password=oracle entries=3

orapwd file='orapwDUPDB' password=oracle entries=3


@start LISTENER

lsnrctl start LISTENER


@START AUXILIARY database


export ORACLE_SID=DUPDB
sqlplus / as sysdba
startup pfile='initDUBDB.ora' nomount;

@START TARGET database

export ORACLE_SID=ORCL
sqlplus / as sysdba
startup mount;


@Connect to RMAN on TARGET instance

rman target / auxiliary sys/oracle@DUPDB



@rman_duplicate.sql script

RUN{

ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK;

DUPLICATE TARGET DATABASE to "DUPDB";

release channel aux1;
release channel aux2;
release channel aux3;
}

Thursday, July 9, 2015

Samba in Oracle Solaris 10

Samba in Oracle Solaris 10


- check package

Docapps# pkginfo -x | grep -i samba
SUNWsmbac                         samba - A Windows SMB/CIFS fileserver for UNIX (client)
SUNWsmbar                         samba - A Windows SMB/CIFS fileserver for UNIX (Root)
SUNWsmbau                         samba - A Windows SMB/CIFS fileserver for UNIX (Usr)


- check samba config file

Docapps# pkgchk -l SUNWsmbar | grep conf-example
Pathname: /etc/sfw/smb.conf-example

- check stage samba

Docapps# svcs -a | grep samba
disable         10:31:59 svc:/network/samba:default

- edit share path on /etc/sfw/smb.conf

cp /etc/sfw/smb.conf-example /etc/sfw/smb.conf

exp:
[myshare]
comment = My Share
valid users = test
path = /u01/app/test
writeable = no
guest ok = yes

- chmod smb.conf file to read only

chmod 0444 /etc/sfw/smb.conf

- check state samba service and start service

Docapps# svcadm disable samba
svcs -a | grep samba

Docapps# svcadm enable samba
svcs -a | grep samba
online         10:42:04 svc:/network/samba:default

-set passwd for samba user

Docapps#/usr/sfw/bin/smbpasswd -a test
password : 123456

- test connect on  MS windows

net use O: \\192.168.1.20\myshare

ESXi 6.0 in LAB

- enable x64 CPU
add line vhv.enable = "TRUE"
in name_of_vmguest.vmx  file


- enable Promiscuous mode to Accept in  vSwitch
on ESXi ALL host

Wednesday, July 8, 2015

sqlplus pagesize

edit glogin.sql @ $ORACLE_HOME/sqlplus/admin

SET PAGESIZE 99
SET LINESIZE 128



Thursday, April 9, 2015

reset factory alcatel sw 6800


Switch-> cd working
Switch-> rm boot.cfg
Switch-> cd ..
Switch-> cd network
Switch-> rm userTable*
Switch-> reload working no rollback-timeout
# Wait for the switch to reload

# Login with "admin" / "switch"

Switch-> copy working certified

user 'test' read-write all password password

Thursday, March 26, 2015

Install Powershell windows 2012 Core server

CMD: install powershell 

dism.exe /online /enable-feature /featurename:MicrosoftWindowsPowerShellRoot
dism.exe /online /enable-feature /featurename:MicrosoftWindowsPowerShell /all
 
/reboot

Powershell: add windows feature
 
Add-WindowsFeature Server-Gui-Shell, Server-Gui-Mgmt-Infra
Shutdown r -t 0

Friday, March 20, 2015

DSQUERY/DSMOD change password next logon

1. set password never expire off

dsquery user OU=TEST,OU=Office,DC=wnet,DC=local | dsmod user –pwdneverexpires no

2. set default password and set Must change password next Logon 

dsquery user OU=TEST,OU=Office,DC=wnet,DC=local | –pwd A1b2C3d4 -mustchpwd yes

Friday, March 6, 2015

relocate redolog oracle



CONNECT / as SYSDBA
STARTUP MOUNT

mv /diska/logs/log1a.rdo /diskc/logs/log1c.rdo
mv /diska/logs/log2a.rdo /diskc/logs/log2c.rdo

ALTER DATABASE 
  RENAME FILE '/diska/logs/log1a.rdo', '/diska/logs/log2a.rdo' 
           TO '/diskc/logs/log1c.rdo', '/diskc/logs/log2c.rdo';

ALTER DATABASE OPEN; 

relocate undo tablespaces oracle

#undo tablespace

SQL>create undo tablespace undotbs2 datafile '/new_location/newundo02.dbf' size 2000m;

#Set new tablespace as undo tablespace
SQL> alter system set undo_tablespace= undotbs2 ;

#Drop old undotbs tablespace
SQL> drop tablespace undotbs including contents;

relocate tempfile oracle

EXAMPLE:

sql>alter database tempfile 'D:\APP\PRAMOTE.L\ORADATA\DW\TEMP01.DBF' offline;

copy tempfile to new location

sql>alter database rename file 'D:\APP\PRAMOTE.L\ORADATA\DW\TEMP01.DBF' to 'E:\oradata\dw\temp01.dbf';

sql>alter database tempfile 'E:\oradata\dw\temp01.dbf' online;

Thursday, March 5, 2015

Remove GlobalProtect

Error msg

"An instance of GlobalProtect is already present on the system. Uninstall the current version before attempting to install the new version of GlobalProtect"

- Remove the registry items within the following registry path (Windows OS):
      HKEY_LOCAL_MACHINE\Software\Palo Alto Networks\GlobalProtect\PanGPS

- Run the following command as an administrator from the windows cmd line:
       sc delete PanGPS

- Reboot the machine

Thursday, February 19, 2015

JAVA 7u45 EMC , NETAPP , Brocade

firefox

about:config
set
security.tls.version.min to 0

Java 7 u45

comment line:

jdk.certpath.disabledAlgorithms=MD2, DSA, RSA keySize < 2048

in

C:\Program Files (x86)\Java\jre7\lib\security\java.security file

Wednesday, February 11, 2015

enable webtool Brocade DS300, JAVA 1.7

comment line:

jdk.certpath.disabledAlgorithms=MD2, DSA, RSA keySize < 2048

in

C:\Program Files (x86)\Java\jre7\lib\security\java.security file

ALCATEL 6900

write memory copy running certified reload from working no rollback-timeout