Developer forum

Forum » Development » Copy content between databases

Copy content between databases

Alec Stubbs
Reply

Hi Guys,

 

I'd like to be able to export page and paragraph content out of one database and import it into another.

 

Does anyone know if this is possible? Maybe it could be an sql script?

 

Cheers,

Alec


Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

It is not possible without doing some magic.

 

The big issue is that the keys/ids are generated by the database and moving pages from one db to another would give you duplicated keys. But if you can solve that, it is relatively easy.

 

BR Nicolai

Votes for this answer: 1
 
Alec Stubbs
Reply

Ok cheers, this is what I thought you'd say!

We'll see what we can do. 

 
Mikkel Ricky
Reply

As Nicolai points out, the big issue is that ids will change when importing content.

I've been thinking about this and I think the challenge can be solve using the following steps (or something similar)

 

  1. Import pages
    • Store mapping from import page ids to new page ids
  2. Import paragraphs
    • Store mapping from import paragraph ids to new paragraph ids
  3. Remap page references
    • Pages (parent, master, …) (re-build page structure)
    • Paragraphs (add paragraphs to newly imported pages)
  4. Remap references in paragraph content
    • Change internal links in paragraph content, e.g. convert stuff like Default.aspx?ID=«page id»#«paragraph id» into Default.aspx?ID=«new page id»#«new paragraph id»

The steps above do not handle items, but they should basically be handled in the same way (import followed by remapping).

Does it make sense? Comments?

 

 

 

 

 

 

 

 
Morten Snedker
Reply

Kinda what Mikkel said:

  1. Disable Identity increement (autonumber) on tables and update key columns (pageID, ParagraphID) with +10000 (or what-ever value makes sense) in source database. Remember FK's (ParagraphPageID, PageParentPageID). Have PageAreaID in mind.
  2. Extract with Data Integration to XML
  3. Make sure destination tables have all columns needed (columns in source, but not in destination)
  4. Import XML using Data Integration

Potential problems: hardcoded ID's, settings saved on each row of Page/Paragraph (in a lump of XML for instance), security (user permission). Probably a few other bumps ahead I've forgotten.



Regards /Snedker






 

 

 

 

 

You must be logged in to post in the forum