web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

Refreshing Test Database

(0) ShareShare
ReportReport
Posted on by

I need to refresh  Microsoft dynamics Test Database from Live.

We have dynamics SL 2015 CU1

I see that there are two databases Finance and FinanaceSys, I can restore databases in Test Environment from backups that is fine,

but I need to know,  do we need to change any records so databases can work in Test environment.

This is my first time refreshing Dynamics database in Test any help will be greatly appreciated.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    system.domain and\or system.company

    you will find the database server name and database names in there.

    then of course run db maintenance - update views and security

  • Suggested answer
    Butch Adams Profile Picture
    4,763 on at

    Here's a basic script I use to sort of automate it. Adjust DB and filenames to meet your needs.

    Use master
    PRINT GETDATE()
    ALTER DATABASE SLTestApp
    SET SINGLE_USER WITH
    ROLLBACK IMMEDIATE
    ALTER DATABASE SLTestSys
    SET SINGLE_USER WITH
    ROLLBACK IMMEDIATE

    RESTORE DATABASE SLTestApp
    FROM DISK = 'D:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Backup\SLApplication.bak'
    WITH REPLACE,
    MOVE 'SLApplication_Data' TO 'D:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\SLTestApp.mdf',
    MOVE 'SLApplication_Log' TO 'D:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\SLTestApp_1.ldf'

    GO

    RESTORE DATABASE SLTestSys
    FROM DISK = 'D:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Backup\restore\SLSystem.bak'
    WITH REPLACE,
    MOVE 'SLSystem_Data' TO 'D:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\SLTestSys.mdf',
    MOVE 'SLSystem_Log' TO 'D:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\SLTestSys_1.ldf'

    ALTER DATABASE SLTestApp SET MULTI_USER
    ALTER DATABASE SLTestSys SET MULTI_USER

    USE SLTestSys
    --Update Server and Database names in system db tables
    update Domain set DatabaseName = 'SLTestApp' where DatabaseName = 'SLApplication'
    update Domain set DatabaseName = 'SLTestSys' where DatabaseName = 'SLSystem'
    update Domain set ServerName = 'TESTSERVER'

    update Company set DatabaseName = 'SLTestApp' where DatabaseName = 'SLApplication'

    --Change colors to RED
    update Company set CpnyColor = 255

    --Rename Companies
    update Company set CpnyName = '-- TEST -- ' + LEFT(CpnyName,19)


    go
    PRINT GETDATE()

    --Now run SL Database Maint and
    --Syncronize all Database Ownership and Security
    --Update Views

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics SL (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans