Skip to end of banner
Go to start of banner

How to find all pages that use SQL for Confluence macros via database

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

This article helps you find all the pages where the SQL for Confluence macros are added to your Confluence instance hosted on the Server or Data Center.

Instructions

  • Log in as Confluence Administrator and navigate to Cogwheel > General configuration > Administration > Macro Usage:

screenshot-1 (1).pngscreenshot-2 (1).png

  • Under All macros, look out for the App name SQL(Pro Edition) for Confluence:

2024-04-03_11-24-50.png

Usage information using SQL queries:

As the SQL for Confluence has three macros, the query must be executed for each macro to get the macro-level usage information. If the query returns any records, the output includes the Title of the page and SpaceID of the relevant pages.

  • For the SQL macro, execute the following query:

    Select CONTENT.Title, CONTENT.SpaceID from CONTENT, BODYCONTENT
    WHERE PREVVER IS NULL AND (CONTENT.CONTENTTYPE = 'PAGE' OR CONTENT.CONTENTTYPE = 'BLOGPOST')
    AND CONTENT.CONTENTID = BODYCONTENT.CONTENTID
    AND (BODYCONTENT.BODY like '%<ac:structured-macro ac:name="sql"%');


    Results:

    2024-04-03_11-13-16.png


  • For the SQL-query macro, execute the following query:

    Select CONTENT.Title, CONTENT.SpaceID from CONTENT, BODYCONTENT
    WHERE PREVVER IS NULL AND (CONTENT.CONTENTTYPE = 'PAGE' OR CONTENT.CONTENTTYPE = 'BLOGPOST')
    AND CONTENT.CONTENTID = BODYCONTENT.CONTENTID
    AND (BODYCONTENT.BODY like '%<ac:structured-macro ac:name="sql-query"%');


    Results:

    2024-04-03_11-12-26.png

  • For the SQL file macro, execute the following query:

    Select CONTENT.Title, CONTENT.SpaceID from CONTENT, BODYCONTENT
    WHERE PREVVER IS NULL AND (CONTENT.CONTENTTYPE = 'PAGE' OR CONTENT.CONTENTTYPE = 'BLOGPOST')
     AND CONTENT.CONTENTID = BODYCONTENT.CONTENTID
     AND (BODYCONTENT.BODY like '%<ac:structured-macro ac:name="sql-file"%');


    Results:

    2024-04-03_11-12-54.png

It is recommended to: 

  • Test the above queries in a test environment. The time taken to get the results is based on the number of pages where the macro has been used.

  • Run the query during off-business hours to reduce any impact caused by the query's run time.

  • Queries have to be adjusted with syntax in databases. 

  • No labels