Wednesday, August 3, 2016

Manual FIX IP and Change Hostname on Solaris 11

1. Switch From Automatic Network Configuration Mode to Manual Network Configuration Mode
   
# netadm enable -p ncp DefaultFixed

2. Verify that DefaultFixed profile is applied
   
# netadm list
netadm: DefaultFixed NCP is enabled;
automatic network management is not available.
'netadm list' is only supported when automatic network management is active.

3. Determine the interface that you want to configure
   
# dladm show-phys

4. Configure the vmxnet3s0 interface
   
# ipadm create-ip net0
# ipadm create-addr -T static -a 192.168.1.10/24 vmxnet3s0/v4

5. Verify
   
# ipadm show-addr
ADDROBJ           TYPE     STATE        ADDR
lo0/v4            static   ok           127.0.0.1/8
vmxnet3s0/v4      static   ok           192.168.1.10/24
lo0/v6            static   ok           ::1/128
   
root@solaris:~# dladm show-link
LINK                CLASS     MTU    STATE    OVER
net0                phys      1500   up       --

6. Add default route
   
# route -p add default 192.168.1.1

7. Add DNS Name Server
   
root@solaris:~# svccfg -s dns/client
svc:/network/dns/client> setprop config/nameserver = (8.8.8.8 8.8.4.4)
svc:/network/dns/client> listprop config
config                      application
config/value_authorization astring     solaris.smf.value.name-service.dns.client
config/nameserver          net_address 8.8.8.8 8.8.4.4
svc:/network/dns/client> exit

root@solaris:~#
root@solaris:~# svcadm refresh dns/client
root@solaris:~# svcadm restart dns/client

8. Set name service switch
   
root@solaris:~# svccfg -s name-service/switch
svc:/system/name-service/switch> setprop config/host = "files dns"
svc:/system/name-service/switch> listprop config
config                      application
config/default             astring     files
config/value_authorization astring     solaris.smf.value.name-service.switch
config/printer             astring     "user files"
config/host                astring     "files dns"
svc:/system/name-service/switch> exit

9. Testing
   
root@solaris:~# ping google.com
google.com is alive

10. Change Hostname
root@solaris:~# svccfg <
select /system/identity:node
#listprop config
setprop config/nodename="newhost"
setprop config/loopback="newhost"
refresh

Monday, August 1, 2016

Clear iSCSI Configuration VSphere ESXi 6.0

- Winscp to the host using SFTP -> navigate to /etc/vmware/vmkiscsid/ and copy the contents to your workstation
- Once copied, delete the contents in /etc/vmware/vmkiscsid/
- Reboot the host
- Create a new software iscsi adapter - > write over the IQN with the old one we copied earlier
- Add iscsi port bindings and targets.

Tuesday, July 19, 2016

Monday, July 4, 2016

Disable virbr0 NAT Interface Oracle Linux

# ifconfig
# virsh net-list
# virsh net-destroy default
# virsh net-undefine default
# service libvirtd restart
# ifconfig

Thursday, June 16, 2016

Find failed LOGON timestamp in ORACLE

"DBA_AUDIT_SESSION"

ex:
select
USERNAME, USERHOST, ACTION_NAME, RETURNCODE, TO_CHAR(TIMESTAMP,'MM/DD HH24:MI') TIMESTAMP
from
dba_audit_session
where
USERNAME like 'ORACLE_USERNAME'
and
RETURNCODE > 0

RETURNCODE:
1017        invalid username/password
28000        Account is Lock
0        Normal Login

Monday, June 13, 2016

PowerShell Backup Script For VMware Server (Clone VMs using 'NEW-VM')

Backup Script Info /Surapong Naowasate v 1.0

Home path
=========
c:\vmware\

Folder:

- Script
- Hostlist
- Log-backup

File:
sc_xxx.ps1 - Script For backup
hl_xxx.txt - Host List For backup
VMware-Backup-xxx.log - Log Backup

Daily Backup info file path
===========================
c:\vmware\Script\Daily\sc_daily.ps1
c:\vmware\Hostlist\hl_daily.txt
c:\vmware\Log-backup\Daily\VMware-Backup-daily-$backup_date-$backup_timestamp

Weekly Backup info file path
===========================
c:\vmware\Script\Weekly\sc_weekly.ps1
c:\vmware\Hostlist\hl_weekly.txt
c:\vmware\Log-backup\Weekly\VMware-Backup-weekly-$backup_date-$backup_timestamp

Monthly Backup info file path

===========================
c:\vmware\Script\Monthly\sc_monthly.ps1
c:\vmware\Hostlist\hl_monthly.txt
c:\vmware\Log-backup\Monthly\VMware-Backup-Monthly-$backup_date-$backup_timestamp

EXP:Daily Backup Script


-------------------------------
Add-PSSnapin VMware.VimAutomation.Core
#Call VMware library

$VM = Get-Content c:\vmware\Hostlist\hl_daily.txt
#get hosting name for backup

$BackupvCenter = "vCenter.domain.local"
#set vCenter Name for connected to Backup

$BackupHost = "esxiHost.domain.local"
#Destination Host for Stored  backup VMs ( by clone VMs)

$backupDate = Get-Date -Format yyyyMMdd-HHmm
#set date format

$backupDatastore = "VMware-Backup-Storage"
#set DataStore for backup

Connect-VIServer -Server $BackupvCenter -User backupuser@domain.local -Password backupuserpassword
#Connet to vCenter

$VM_LOG = 'c:\vmware\Log-backup\Daily\VMware-Backup-daily-'+$backupDate+'.log'
#set log path and backup filename

foreach ($line in $VM) {

Get-VM -Server $BackupvCenter  | where { $_.PowerState -like 'PoweredOn' -and $_.name -like $line } | select name, vmhost, guestid, numcpu,memorymb | Out-File $VM_LOG -Append
#get information Guest VMs for backup

$VM_TMP = 'Backup-VMs-daily-'+$backupDate+'-'+$line
#set newname Guest VMs for backup

New-VM -Name $VM_TMP -VM $line -VMHost $BackupHost -Datastore $backupDatastore -Location Daily | Out-File $VM_LOG -Append
#clone VMs to backup Storage
 


$last7day = (get-date (get-date).AddDays(-7) -Format yyyyMMdd)
$VM_OLD_BACKUP = 'Backup-VMs-daily-'+$last7day+'-0000-'+$line
Remove-VM $VM_OLD_BACKUP -DeleteFromDisk -Confirm:$false
#remove VM from Datastore Last 7 day (dailybackup)

}
---------------------------------------


ADD to Windows TASK Schedule
============================
- Create Task
- Set name of  Schedule JOB
- Set Account for run backup schedule (DOMAIN\backupuser)
- Set Run whether user is logged on or not
- Create Trigger for job ex. daily, weekly, monthly
- Set Action for job ex. run powershell
    - start a program 'powershell'
    - add argument '-file c:\vmware\script\powershell_script'
    - start in directory 'c:\vmware\script'
- Click OK , Scheduled Task will asked for password of backup user (DOMAIN\backupuser)

Friday, June 10, 2016

Run Vmware PowerCLI on Windows Schedule Task

There 2 way to Doing:


1. Load Vmware LIB

Add-PSSnapin Vmware.VimAutomation.Core

in vmware powershell script (*.ps1)

2. exec in windows schedule task

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI" $ "Parh_to_PowerShell_Script"

ALCATEL 6900

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