Last cluster failover sql script to find out

--Last cluster failover sql script to find out

CREATE TABLE #ErrorLog(
LogDate DATETIME,

ErrorSource NVARCHAR(MAX),

ErrorMessage NVARCHAR(MAX)

)
CREATE TABLE #NumberOfLogs(

ID INT PRIMARY KEY NOT NULL,

LogDate DATETIME NOT NULL,

LogFileSize bigint
)
 
INSERT INTO #NumberOfLogs(ID,LogDate,LogFileSize)

EXEC master.dbo.xp_enumerrorlogs

DECLARE @ErrorLogID INT

DECLARE cNumberOfLogs CURSOR FOR

SELECT ID

FROM #NumberOfLogs

OPEN cNumberOfLogs

FETCH NEXT FROM cNumberOfLogs INTO @ErrorLogID

WHILE @@FETCH_STATUS = 0

BEGIN

INSERT INTO #ErrorLog(LogDate,ErrorSource,ErrorMessage)

EXEC sp_readerrorlog @ErrorLogID, 1, 'NETBIOS'

INSERT INTO #ErrorLog(LogDate,ErrorSource,ErrorMessage)

EXEC sp_readerrorlog @ErrorLogID, 1, 'SQL Server is terminating'

FETCH NEXT FROM cNumberOfLogs INTO @ErrorLogID

END

CLOSE cNumberOfLogs

DEALLOCATE cNumberOfLogs

SELECT LogDate, ErrorMessage FROM #ErrorLog

DROP TABLE #ErrorLog

DROP TABLE #NumberOfLogs

MySQL database migration from one server to another server.

MySQL database migration from one server to another server.

Connect to Testmysql01 using ssh

Take a dump of Test_database database

[root@Testmysql01 ~]# mysqldump -u root -p Test_database  > /opt/Test_database.sql

Copy the Dump file to Testmysql02

[root@Testmysql01 ~]# scp /opt/Test_database.sql root@Testmysql02.domain.com:/opt

[root@Testmysql01 ~]# Exit

Connect to Testmysql02 using ssh

connect to MySQL

[root@Testmysql02~]# MySQL -u root -p

Create Database and grant permission for the user

MySQL> create database Test_database;

MySQL> GRANT ALL ON Test_database.* TO testuser@'%' IDENTIFIED BY 'password';

MySQL> quit

Import Dump to new database

[root@Testmysql02~]# MySQL -u root -p Test_DBA < /opt/Test_DBA.sql

[root@Testmysql02~]# Exit

Connect to webserver using RDP.

Navigate to C:\inetpub\Test_database\Test_dat
abase\config

Edit file config.php and change 'dbhost' => in the file to Testmysql02.domain.com.

verify 'dbuser' => and 'dbpassword' => is defined correctly.

restart the site from IIS manager

connect to Test_database  site and verify everything is working fine.