DB2 avanzado tablespaces masks grants y movimientos
Este post cubre tareas DB2 de segundo nivel: revision de tablespaces, grants, mascaras, movimientos de tablas, export/import y runstats.
Tablespaces
1
2
| db2 list tablespaces show detail
db2 "select tbsp_name, tbsp_state, tbsp_used_pages, tbsp_free_pages from sysibmadm.tbsp_utilization"
|
Crear tablespace
1
| db2 "create regular tablespace <TABLESPACE> pagesize 32k managed by automatic storage extentsize 32 prefetchsize automatic bufferpool <BUFFERPOOL>"
|
Mover tabla
1
| db2 "call sysproc.admin_move_table('<ESQUEMA>', '<TABLA>', '<TABLESPACE_DATOS>', '<TABLESPACE_INDICES>', '<TABLESPACE_LOBS>', '', '', '', '', '', 'MOVE')"
|
Export e import IXF
1
2
| db2 "export to /ruta/ejemplo/<TABLA>.ixf of ixf select * from <ESQUEMA>.<TABLA>"
db2 "import from /ruta/ejemplo/<TABLA>.ixf of ixf insert into <ESQUEMA>.<TABLA>"
|
Grants
1
2
| db2 "grant select on table <ESQUEMA>.<TABLA> to user <USUARIO>"
db2 "grant select, insert, update, delete on table <ESQUEMA>.<TABLA> to group <GRUPO>"
|
Masks y permisos
1
2
| db2 "select tabschema, tabname, secpolicyname from syscat.tables where secpolicyname is not null"
db2 "select tabschema, tabname, colname, maskname from syscat.columnmasks"
|
Runstats
1
| db2 "runstats on table <ESQUEMA>.<TABLA> with distribution and detailed indexes all"
|