Today I’ll be handling an issue I had when migrating a SQL Server 2000 database to SQL Server 2012. We migrated the database from the old, grumpy, and more importantly, unsupported Windows Server 2003 and SQL Server 2005 instance. All was well, and we had no instant issues when users started working with the application. The migration was seamless, we did not expect any future problems. Even the upgrade advisor did not give us any errors!
But then lightning struck: somebody who was on a holiday came back into work and started working with the application on the migrated database. Apparently this user was slightly different from the other users who had been testing, since he used the application to its full capacity. This unravelled a waterfall of syntax errors & DB errors. The impact was uncontrollable, so there was only one option: fall back to the old & abandoned SQL Server 2000 instance.
Now here the tricky part starts. As users had been utulizing the migrated database in production for several days, they had uploaded a lot of data which had to be present when we fell back to the SQL Server 2000 instance. However, as most of you know, once a database is on SQL Server 2012, even in lower compatibility mode, it will not restore ina version lower than the running version! It is also not possible to detach and attach the database, as there are changes which happened on system table level. Due to these restrictions there was only one option left: scripting out the database and exporting the data to the old SQL Server 2000 database. How can you do this? I’ll explain step-by-step how we execued thsis fall back scenario.
First, we generated the scripts off the database. We chose to script out the entire database and all database objects. Watch out for triggers, though, because these are not scripted out. You will have to manually add them later. Click next to create the scripts and copy them to clipboard/file/new query window, whatever has your preference. Then click next again, it will now script out your database.
Execute the script on the destination server, we used a SQL server 2005. You might get some errors for adding members and altering compatibility mode, depending on the SQL server version you are working with. You can alter the statements to statements that work on your version. Also you might want to set your database owner to sa at this point.
Now that we have our database on our SQL Server 2005, we want to pump the data from the new old database. Go to the database you want to export the data from and click export data.
Enter the information of your source database and insert the information of the destination database.Then choose to copy data from table. In the next window, select all your tables, and check table by table by clicking Edit Mappings…
Don’t forget to tick off Enable identity insert on the tables! Also, if you have foreign keys, don’t forget to disable them when loading your data between the instances. You can easily do that with the following command:
-- Disable all the constraint in database
EXEC sp_msforeachtable ‘ALTER TABLE ? NOCHECK CONSTRAINT all’
After the export, also remember to re-enable your foreign keys:
-- Enable all the constraint in database
EXEC sp_msforeachtable ‘ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all’
If you followed the steps above, you should be able to export your data to your SQL server 2000 database. This way we restored a SQL Server 2012 database on a SQL Server 2005 instance, so we consider the fall back as successful! All data was present and the business was happy. Now we can start testing the application again for compatibility with the SQL Server 2012 version, which will prove to be a long and though process! The application is working again to its full extent, though. Unfortunately it is on a SQL Server 2005 instance with a compatibility mode of SQL Server 2000 with a Windows Server 2003. (unsupportedception)
Hope you enjoyed reading this blog and stay tuned!
© 2023 Kohera
Crafted by
© 2022 Kohera
Crafted by
Cookie | Duration | Description |
---|---|---|
ARRAffinity | session | ARRAffinity cookie is set by Azure app service, and allows the service to choose the right instance established by a user to deliver subsequent requests made by that user. |
ARRAffinitySameSite | session | This cookie is set by Windows Azure cloud, and is used for load balancing to make sure the visitor page requests are routed to the same server in any browsing session. |
cookielawinfo-checkbox-advertisement | 1 year | Set by the GDPR Cookie Consent plugin, this cookie records the user consent for the cookies in the "Advertisement" category. |
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
CookieLawInfoConsent | 1 year | CookieYes sets this cookie to record the default button state of the corresponding category and the status of CCPA. It works only in coordination with the primary cookie. |
elementor | never | The website's WordPress theme uses this cookie. It allows the website owner to implement or change the website's content in real-time. |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Cookie | Duration | Description |
---|---|---|
__cf_bm | 30 minutes | Cloudflare set the cookie to support Cloudflare Bot Management. |
pll_language | 1 year | Polylang sets this cookie to remember the language the user selects when returning to the website and get the language information when unavailable in another way. |
Cookie | Duration | Description |
---|---|---|
_ga | 1 year 1 month 4 days | Google Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors. |
_ga_* | 1 year 1 month 4 days | Google Analytics sets this cookie to store and count page views. |
_gat_gtag_UA_* | 1 minute | Google Analytics sets this cookie to store a unique user ID. |
_gid | 1 day | Google Analytics sets this cookie to store information on how visitors use a website while also creating an analytics report of the website's performance. Some of the collected data includes the number of visitors, their source, and the pages they visit anonymously. |
ai_session | 30 minutes | This is a unique anonymous session identifier cookie set by Microsoft Application Insights software to gather statistical usage and telemetry data for apps built on the Azure cloud platform. |
CONSENT | 2 years | YouTube sets this cookie via embedded YouTube videos and registers anonymous statistical data. |
vuid | 1 year 1 month 4 days | Vimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. |
Cookie | Duration | Description |
---|---|---|
ai_user | 1 year | Microsoft Azure sets this cookie as a unique user identifier cookie, enabling counting of the number of users accessing the application over time. |
VISITOR_INFO1_LIVE | 5 months 27 days | YouTube sets this cookie to measure bandwidth, determining whether the user gets the new or old player interface. |
YSC | session | Youtube sets this cookie to track the views of embedded videos on Youtube pages. |
yt-remote-connected-devices | never | YouTube sets this cookie to store the user's video preferences using embedded YouTube videos. |
yt-remote-device-id | never | YouTube sets this cookie to store the user's video preferences using embedded YouTube videos. |
yt.innertube::nextId | never | YouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen. |
yt.innertube::requests | never | YouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen. |
Cookie | Duration | Description |
---|---|---|
WFESessionId | session | No description available. |