Skip to content

Instantly share code, notes, and snippets.

View asvignesh's full-sized avatar

Vignesh A Sathiyanantham asvignesh

View GitHub Profile
@asvignesh
asvignesh / oracle_post.sh
Created February 8, 2020 12:27
Oracle database pre and post script for Nimesa
export ORACLE_HOME=/oracle/oracle11g
$ORACLE_HOME/bin/sqlplus / as sysdba <<EOF
spool $ORACLE_HOME/log/backup.log;
alter database end backup;
spool off;
EOF
@asvignesh
asvignesh / mysql-post.py
Last active August 31, 2019 15:51
MySQL Application consistent backup for Nimesa
import MySQLdb
import os
import time
import datetime
dt=datetime.datetime.now().strftime("%I:%M%p on %B %d, %Y")
file1 = open("/scripts/post-thaw.log","a+" )
try:
os.remove('/tmp/freeze_snap.lock')
@asvignesh
asvignesh / Nimesa Role.json
Created August 21, 2019 17:00
Nimesa IAM Role
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:CopySnapshot",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:ModifyVolumeAttribute",
@asvignesh
asvignesh / CustomAuthentication.java
Created August 13, 2019 05:19
Spring boot REST Security
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
/**
@asvignesh
asvignesh / vm_from_template.yml
Created June 5, 2019 07:42
Provision vSphere VM from Template on Ansible
- hosts: localhost
connection: local
tasks:
- name: Clone VM from Template
- vmware_guest:
hostname: vcenter.asvignesh.in
username: administrator@asvignesh.in
password: password
validate_certs: no
name: newvm001
Connect-VIServer -Server vcenter.asvignesh.in -Credential
$ovfPath = "C:\Users\asvig\Downloads\nimesa.ova"
$ovfConfig = Get-OvfConfiguration -Ovf $ovfPath
$ovfConfig.Common.ip.Value="10.10.x.x"
$ovfConfig.Common.netmask.Value="255.255.0.0"
$ovfConfig.Common.gateway.Value="10.0.0.1"
$ovfConfig.Common.dns1.Value="8.8.4.4"
$ovfConfig.Common.dns2.Value="8.8.8.8"
$ovfConfig.NetworkMapping.VM_Network.Value="VM Network"
@asvignesh
asvignesh / change_recovery_model_full.ps1
Created May 9, 2019 07:39
Powershell Script to change the recovery model of the databases to FULL
$dbs = Get-SqlDatabase -ServerInstance NW1\CLUST2
foreach ($database in $dbs | where { $_.IsSystemObject -eq $False })
{
$dbName = $database.Name
$sql = @"
USE [master]
GO
ALTER DATABASE [$dbName] SET RECOVERY FULL WITH NO_WAIT
GO
"@
@asvignesh
asvignesh / BackupAllDatabases.ps1
Last active May 2, 2019 07:44
Powershell script to backup all database, to run .\BackupAllDatabases.ps1 -serverName NW\CLUST -backupDirectory c:\backupdir
param(
$serverName,
$backupDirectory
)
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoExtended") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoEnum") | Out-Null
@asvignesh
asvignesh / BackupAllDatabases.ps1
Created May 2, 2019 07:44
Powershell script to backup all database
param(
$serverName,
$backupDirectory
)
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoExtended") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoEnum") | Out-Null
@asvignesh
asvignesh / BackupAllDatabases.ps1
Created May 2, 2019 07:44
Powershell script to backup all database
param(
$serverName,
$backupDirectory
)
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoExtended") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoEnum") | Out-Null