How to properly import pages from one Confluence instance to another instance?

Diana
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 24, 2022

We have 2 instance. We'll call them instance "U" and instance "C". And I want to export pages from "U" to "C", just a parent page and all it's child pages and attachments, not the entire "U" space. The two instance both have the same space name and space keys since they're both the same project under different environments. Only the content is different.

Export is simple. I followed these steps and saved an xml file.

Now to import, from my understanding of these guidance 1, 2, 3 (and correct me if I'm wrong), in order to import my desired pages into a space with the same name even if it's a different instance, it will not work. I would have to rename the spacekeys inside the xml and properties file to a new name. Then go into the system admin settings > Administration > Backup & Restore, and upload the entire zip file to create a "temp" space, and after it's import, move those pages to the desired space.

But after I rename the space key in the xml and exportdescriptor file, I get an error "Missing exportDescriptor.properties" even though it is in there. Then I found this solution why. But I can't save the original file as an xml file when trying to rename the space keys.

Does anyone have guidance on how to properly import pages from one instance to another?

1 answer

1 accepted

0 votes
Answer accepted
Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 24, 2022

The way you describe it is how I'd do it, but this part is unclear to me:

But I can't save the original file as an xml file when trying to rename the space keys.

 

Why not? I mean the whole process you describe is the way to do it, so why is saving the file an issue?

Diana
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 24, 2022

hi @Radek Dostál 

I'm not sure myself, honestly. I've tried saving out a copy of the original files, make the edits, but then I get the same error as above.

Also, is the "Import" from "Space Tools" only viable for linux users? How do I import directory as a windows user if I know the location of the files?

Diana
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 25, 2022

hi @Radek Dostál 

So an update, I was able to import the pages as a new space, but now I can't see the space. I imported via the admin settings > Backup & Restore > Upload a site or space export file. I've tried both unchecking the Build Index and checking the Build Index.

When I go to Space Permissions, I can see the Individual Spaces and the Key that I've made changes so I know the newly import spaces are created, but when I click Manage Permissions, it says Page Not Found. Yet I have full System Administrator permissions. Under Global Permissions, I'm under the groups "confluence-administrators", I've even given myself Individual Users global permissions for all can use "Personal Space", "Create Space", "Confluence Administrator", "System Administrator".

Still curious about the "Import" from "Space Tools" question I had early, but additional question, is there additional steps I'm missing to seeing my import space?

Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 25, 2022

So you can see the space listed in 'Space Permissions', but the link 'Manage Permissions' opens as a "Page Not Found"? Interesting.

 

That sounds as something got broke during the import, if that Space existed, this page should always open.

 

Are you able to delete the space via https://confluenceblabla.com/spaces/removespace.action?key=<SPACEKEY> or does it throw any other errors?

Edit2 - there used to be a bug of sorts where the "permissions" tab was missing, does opening the "details" work by a very odd chance?

/spaces/viewspacesummary.action?key=<SPACEKEY>

 

Can you confirm the Space does indeed exist by looking for it in the database, which should work with this:

select * from spaces where spacekey = 'SPACEKEY';

--maybe this might be worth a look at too
select * from spacepermissions where spaceid = <spaceid>;

 

I'm not sure if this is possible but it's an idea, maybe the space permissions page is showing you the space because it has it in cache (perhaps generated during the import), but the import itself failed and the Space in fact does not exist, it could just be an incorrect cache. Might try to flush any space and space permission caches from 'Cache Management' page to see if it still shows the space in space permissions.

Although I have no idea if that page even uses the cache at all, and whether the import could cause it, just kind of a thought. The db is the better way of confirmation.

 

Other than that, probably would need to tail <confluence_home>/logs/atlassian-confluence.log to see if it throws any errors during the import. Would try both when trying to open space permissions as well as during the import.

 

Also, is the "Import" from "Space Tools" only viable for linux users? How do I import directory as a windows user if I know the location of the files?

I don't know what you mean by linux/windows. The tooltip says files from a specific directory (so accessible by each node in the cluster, the shared home),

2022-10-25 16_26_51-Import Pages.png

 

Frankly I didn't really know this existed, but according to https://confluence.atlassian.com/doc/import-a-text-file-139492.html it accepts text, html or confluence storage format.

As for word export, eh I certainly doubt it would process it in any other way than gibberish. No macros, broken formatting, etc. If even. But who knows.

As for html, well since what you see in Confluence is a ton of bundled stylesheets, and since it has no html export out of box (that I know of), unlikely to get such files.

As for Confluence storage format, if memory serves, you only get a single entities.xml file from an xml space export. It certainly would be possible to parse page title+content out of it and generate files for it, although kind of an overkill to script it.

There is though /plugins/viewstorage/viewpagestorage.action?pageId=<pageid> endpoint to view storage format per page, so theoretically you could iterate over your pages and store the storage format as a file. Still, sounds too time-costly to do.

(Edit: also could be exported from the database of source instance, but.. meh, db schema of confluence is a giant pita to deal with)

 

All in all I don't see it as a viable option myself. Either, the time to get the format for it would take too long, or, we're talking about a few pages where copy paste would have done the job already. So assuming it's more of a sizable amount of content, the space import would be easier and with more complete data, where we know Confluence will attempt to import attachments, page permissions, comments, etc., rather than plain text.

Diana
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 27, 2022

hi @Radek Dostál 

Thank you! After checking through the audit logs, I saw the import had actually failed. So that explains why the "Page Not Found" error occurred, just seemed weird that I was able to see the space key in the Space Permissions.

But further investigating, it turns out different versions when export/import can cause issues. The instance I was exporting from, instance "U", is under a different environment and has the latest version. While our other instance "C" that I was trying to import the pages to, is an older version. So I think that was my final root cause.

But this has been a tremendous help. Thank you again!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events