Thursday, September 10, 2015

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;
}

ALCATEL 6900

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