Skip to main content

Notifications

Microsoft Dynamics SL (Archived)

Refreshing Test Database

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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

  • Suggested answer
    Butch Adams Profile Picture
    Butch Adams 4,757 on at
    RE: Refreshing Test Database

    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

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Refreshing Test Database

    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

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

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans