9.7.5.2 Change the Permissions on the Test Master to Read-Write

To modify the data files from read-only to read-write you can use SQL to generate a script of SQL commands.

Before starting this part of refreshing the read-only test master database, you must first drop the snapshot databases.
  1. After all Exadata snapshot databases have been deleted, start up the test master database in mount mode.
  2. Create a script to reset permissions on the data files for the test master database.

    Connect to the test master using SQL*Plus and run the following script to create a new SQL script that contains the commands to reset permissions on the data files belonging to the test master database.

    set newpage 0 
    set linesize 999 
    set pagesize 0 
    set feedback off 
    set heading off 
    set echo off 
    set space 0 
    set tab off 
    set trimspool on 
    spool change_perm.sql 
    select 'ALTER DISKGROUP DATA set permission owner=read write, 
    group=read write, other=none for file '||''''||name||''''||';' from v$datafile; 
    exit 
    
  3. Remove the extra lines from the generated script.

    Run the following sed command to remove extra lines from the change_perm.sql script that you created in the previous step. Run this command from an operating system prompt, in the directory that contains the change_perm.sql script.

    $ sed -i '/SQL/d' change_perm.sql
    
  4. Use the generated script to change the file permissions.

    Use SQL*Plus to connect to an Oracle ASM instance as a SYSASM user. Run the change_perm.sql script. This script changes the permissions of the test master's data files to make them writable.

    SQL> @change_perm