USE master

EXEC sandbox.dbo.setMasterIdentity @in_type = 'phcy' -- varchar(10)
--EXEC sandbox.dbo.setMasterIdentity @in_type = 'adrRef' -- varchar(10)

ALTER DATABASE [ArizonaREP] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
RESTORE DATABASE [ArizonaREP] FROM  DISK = N'D:\backups\ama adr ref N1\ArizonaREP_Dump.bak' WITH  FILE = 1,  MOVE N'ArizonaREP_Data' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\ArizonaREP.mdf',  MOVE N'ArizonaREP_Log' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\ArizonaREP_1.ldf',  NOUNLOAD,  REPLACE,  STATS = 5
ALTER DATABASE [ArizonaREP] SET MULTI_USER WITH ROLLBACK IMMEDIATE;
GO
ALTER DATABASE [ArizonaREP] SET RECOVERY SIMPLE
GO

ALTER DATABASE Arizona SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
RESTORE DATABASE [Arizona] FROM  DISK = N'D:\backups\ama705\Arizona_Dump.bak' WITH  FILE = 1,  MOVE N'Arizona_Data' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\Arizona.mdf',  MOVE N'Arizona_Log' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\Arizona_1.ldf',  MOVE N'Arizona_FSData' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\Arizona_FSData',  NOUNLOAD,  REPLACE,  STATS = 5
ALTER DATABASE Arizona SET MULTI_USER WITH ROLLBACK IMMEDIATE;
GO
ALTER DATABASE [Arizona] SET RECOVERY SIMPLE
GO

RESTORE DATABASE [ArizonaCASH] FROM  DISK = N'D:\backups\ama705\ArizonaCASH_Dump.bak' WITH  FILE = 1,  MOVE N'ArizonaCASH_Data' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\ArizonaCASH.mdf',  MOVE N'ArizonaCASH_Log' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\ArizonaCASH_log.ldf',  NOUNLOAD,  REPLACE,  STATS = 5
GO
ALTER DATABASE [ArizonaCASH] SET RECOVERY SIMPLE
GO

RESTORE DATABASE [ActivePos_read] FROM  DISK = N'D:\backups\ama705\ActivePos_read_Dump.bak' WITH  FILE = 1,  MOVE N'ActivePos_read_Data' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\ActivePos_read.mdf',  MOVE N'ActivePos_read_Log' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\ActivePos_read_log.ldf',  NOUNLOAD,  REPLACE,  STATS = 5
GO
ALTER DATABASE [ActivePos_read] SET RECOVERY SIMPLE
GO

RESTORE DATABASE [ActivePos_server] FROM  DISK = N'D:\backups\ama705\ActivePos_server_Dump.bak' WITH  FILE = 1,  MOVE N'ActivePos_server_Data' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\ActivePos_server.mdf',  MOVE N'ActivePos_server_Log' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\ActivePos_server_1.ldf',  NOUNLOAD,  REPLACE,  STATS = 5
GO
ALTER DATABASE [ActivePos_server] SET RECOVERY SIMPLE
GO

RESTORE DATABASE [ActivePos_write] FROM  DISK = N'D:\backups\ama705\ActivePos_write_Dump.bak' WITH  FILE = 1,  MOVE N'ActivePos_write_Data' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\ActivePos_write.mdf',  MOVE N'ActivePos_write_Log' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\ActivePos_write_1.ldf',  NOUNLOAD,  REPLACE,  STATS = 5
GO
ALTER DATABASE [ActivePos_write] SET RECOVERY SIMPLE
GO

RESTORE DATABASE [ActiveSystemClient] FROM  DISK = N'D:\backups\ama705\ActiveSystemClient_Dump.bak' WITH  FILE = 1,  MOVE N'ActiveSystemClient_Data' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\ActiveSystemClient.mdf',  MOVE N'ActiveSystemClient_Log' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\ActiveSystemClient_1.ldf',  NOUNLOAD,  REPLACE,  STATS = 5
GO
ALTER DATABASE [ActiveSystemClient] SET RECOVERY SIMPLE
GO

RESTORE DATABASE [ActiveSystemServer] FROM  DISK = N'D:\backups\ama705\ActiveSystemServer_Dump.bak' WITH  FILE = 1,  MOVE N'ActiveSystemServer_Data' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\ActiveSystemServer.mdf',  MOVE N'ActiveSystemServer_Log' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\ActiveSystemServer_1.ldf',  NOUNLOAD,  REPLACE,  STATS = 5
GO
ALTER DATABASE [ActiveSystemServer] SET RECOVERY SIMPLE
GO

RESTORE DATABASE [HCITools] FROM  DISK = N'D:\backups\ama705\HCITools_Dump.bak' WITH  FILE = 1,  MOVE N'HCI_tools' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\HCITools.mdf',  MOVE N'HCI_tools_log' TO N'D:\sql\MSSQL15.MSSQLSERVER\MSSQL\DATA\HCITools_1.ldf',  NOUNLOAD,  REPLACE,  STATS = 5
GO
ALTER DATABASE [HCITools] SET RECOVERY SIMPLE
GO

