4.2.1 Work with Notebook Versions on the Notebooks Page

By creating versions of your notebook, you can archive your work in a notebook.

You can create versions of notebooks on the Notebooks page, as well as in the Notebook editor. In this example, the Notebook Versioning Demo notebook is created and versioned as Version 1.

Note:

A versioned notebook is non-editable. If you want to make any changes to a particular version of a notebook, you must restore that version to edit it.
Prerequisites: The Notebook Versioning Demo notebook. This notebook is created as part of the example here.
To create a new notebook version and view version history:
  1. On the Notebooks page, click Create Notebooks.
  2. In the Create Notebooks dialog, enter the name Notebook Versioning Demo in the Name field and click OK. The notebook is created and it opens in the notebook editor.
  3. On the notebook, hover your cursor over the lower border of the paragraph and click the + icon to add a paragraph. Add two more paragraphs to this notebook, and paste the following PL/SQL script in the paragraphs:
    Add Paragraph
    1. In the first paragraph, copy and paste the following PL/SQL script. This script creates the view ESM_SH_DATA from the SALES table present in the SH schema.
      %script
      
      CREATE OR REPLACE VIEW ESM_SH_DATA AS 
        SELECT TIME_ID, AMOUNT_SOLD FROM SH.SALES;
    2. In the second paragraph, copy and paste the following SQL script. This script gives a count of the record present in the view ESM_SH_DATA.
      %script
      SELECT count(*) from ESM_SH_DATA;
    3. In the third paragraph, copy and paste the following SQL script to review the data in a tabular format.
      SELECT * FROM ESM_SH_DATA
      FETCH FIRST 10 ROWS ONLY;
  4. Run all the paragraphs, and go back to the Notebooks page after all the paragraphs run successfully.
  5. On the Notebooks page, select the Notebook Versioning Demo notebook to enable all the edit options, and click Versions to go to the versions page for this notebook.
    Versions option
    The Versions - Notebook Versioning Demo page opens.
  6. On the Versions - Notebook Versioning Demo page, click Version to create a new version of the notebook. This opens the Create Version dialog.
    Versions Page
  7. In the Create Versions dialog:
    1. Name: Enter Version 1 for the new version of this notebook
    2. Comments: Enter comments, if any.
    3. Click OK. Once the notebook version is created, it is listed on the Versions - Notebook Versioning Demo page.
    Versions page 2
  8. On the Versions - Notebook Versioning Demo page, select Version 1 of the notebook version that you just created to enable all the available options.
    Select Version 1
    • Click Delete to delete the selected version of the notebook.
    • Click Restore to restore the selected version of the notebook.

      Note:

      Restoring a selected version of the notebook will discard all the unversioned changes, if any.
    • Click Back to Notebooks to go back to the Notebooks page.