PDB initialization SQL scripts
nblxa opened this issue · 0 comments
nblxa commented
Is your feature request related to a problem? Please describe.
The application needs the PDB to contain special changes performed by SYS, for example, permissions on dictionary objects owned by SYS with GRANT OPTION.
Describe the solution you'd like
The Database resource could contain a reference to a SQL script to be executed on PDB creation, either directly embedded as text or as a reference to a ConfigMap.
For example, with the script provided via a ConfigMap:
apiVersion: oracle.db.anthosapis.com/v1alpha1
kind: Database
metadata:
name: mydb
spec:
instance: mydb
name: MY_PDB
admin_password: ...
initializationScript:
configMapRef:
name: mydb-init-scripts
key: init.sql
alternatively, just embedded SQL:
initializationScript:
sql: |
GRANT SELECT ON ALL_TABLES TO GPDB_ADMIN WITH GRANT OPTION;
If the script fails, the Database should not reach the Ready state.
Describe alternatives you've considered
- Build a seeded image that contains PDB$SEED with the customizations (requires use of undocumented parameters).
- Build a seeded image that contains a customized PDB for cloning; let El Carro create new PDBs as clones of the custom one.