说明
A用户:请求
B用户:视图
C用户:源数据
B用户创建了一个C用户表的视图,A用户请求B用户视图的查询权限
当前C用户已授予B用户的select with grant option权限
B用户已授予A用户的select权限
主库A用户查询视图无报错,备库A用户查询视图报错无权限ORA-01031
主备库同步未发现异常
备库查询权限均与主库一致
解决方案
查看当前SPID
SELECT spid
FROM v$process
WHERE addr = (SELECT paddr FROM v$session WHERE sid = (SELECT sid FROM v$mystat WHERE rownum = 1));
对进程收集errorstack
oradebug setmypidoradebug unlimitoradebug dump errorstack 3
执行报错的语句
oradebug dump errorstack 3oradebug tracefile_name
或
alter system set events '1031 trace name errorstack level 3';
出现报错后
alter system set events '10314 trace name errorstack off';
查看trace文件
KCB:[K]ernel [C]ache layer [B]ufferK2 :[K]ernel [2]-PhaseKCC:[K]ernel [C]ache layer [C]ontrol fileKCF:[K]ernel [C]ache layer [F]ile managementKCL:[K]ernel [C]ache layer [L]ock managementKCL:[K]ernel [C]ache layer [R]edo ComponentKCK:[K]ernel [C]ache layer [K]ompatibility ManagementKDN:[K]ernel [D]ata Layer Sequence [N]umber ComponentKDX:[K]ernel [D]ata Layer Inde[X] Block ComponentKGH:[K]ernel [G]eneric Layer [H]eap ManagerKGI:[K]ernel [G]eneric Layer [I]nstantiation ManagerKGL:[K]ernel [G]eneric Layer [L]ibrary Cache ManagerKGK:[K]ernel [G]eneric Layer [K]ompile LayerKLL:[K]ernel [L]oader [L]ibraryKMC:[K]ernel [M]ulti-Threaded Layer [C]ircuit componentKMM:[K]ernel [M]ulti-Threaded Layer [M]onitor Server/dispatcherKQD:[K]ernel [Q]uery Layer [D]ictionary Cache ManagementKQF:[K]ernel [Q]uery Layer [F]ixed Tables/views ManagementKQR:[K]ernel [Q]uery Layer [R]ow Cache ManagementKSB:[K]ernel [S]ervice Layer [B]ackground ManagementKSI:[K]ernel [S]ervice Layer [I]nstance ManagementKSL:[K]ernel [S]ervice Layer [L]ock ManagementKSM:[K]ernel [S]ervice Layer [M]emory ManagementKSP:[K]ernel [S]ervice Layer [P]arameter ComponentKSQ:[K]ernel [S]ervice Layer En[Q]ueue ManagementKSU:[K]ernel [S]ervice Layer [U]ser ManagementKSX:[K]ernel [S]ervice Layer E[X]ecution ManagementKTAD:[K]ernel [T]ransaction Layer Table [A]ccess [D]efinitionKTC:[K]ernel [T]ransaction Layer [C]ontrol ComponentKTS:[K]ernel [T]ransaction Layer [S]or[T] SegmentsKTT:[K]ernel [T]ransaction Layer [T]ablespaceKTU:[K]ernel [T]ransaction Layer [U]ndoKVI:[K]ernel Performance Layer [V] [I]nformation tablesKZD:[K]ernelSecurity Layer [Z][D]ictionary ComponentKZS:[K]ernel Security Layer [Z][S]ecurity StateKXF:[K]ernelE[X]ecution Layer Parallel Query (Execute [F]ast)KXS:[K]ernelE[X]ecution Layer [S]hared CursorOracle 内核层代码缩写以及释义 - Oracle Kernel Database LayersKS: Kernel ServicesKX: Kernel ExecutionK2: Kernel Distributed TransactionsKK: Kernel CompilationKZ: Kernel SecurityKQ: Kernel QueryKA: Kernel AccessKD: Kernel DataKT: Kernel TransactionsKC: Kernel CacheKJ: Kernel LockingKG: Kernel Generic下面是对这些内核层的简短说明,以便更好地理解 x$ 表与数据库内核之间的关系。 内核服务层为数据库内核堆栈中的所有其他层提供所需的数据库服务。
例如,它为会话和实例级别调节数据库中的初始化参数,以及管理数据库并发操作的锁定、闩锁操作和数据库和实例级别统计的等待事件管理。 接下来要介绍的是内核执行层。The Kernel Execution layer performs code executions from the Kernel Compilation layer (KK) and handles bind operations for PL/SQL code as well as recursive calls within the shared pool area for the Oracle 11g SGA.The Kernel Distributed Transaction(K2) layer manages operations involved within distributed transactions including two-phase commit tasks within the Oracle 11g database.The Kernel Compilation (KK) layer is responsible for managing the compilation of PL/SQL objects along with tasks performed by the Oracle optimizer.Next is the Kernel Security layer (KZ) which manages role and system privileges within the Oracle 11g database for security operations.The Kernel Query (KQ) layer handles row caching operations from the data dictionary. It provides critical tasks so that the Kernel Security (KZ) and Kernel Compilation (KK) layers are able to receive data from the query results performed at this Kernel Query layer.Kernel Access (KA) provides operations that permit access to database segments as well as routing information to other kernel layers within the Oracle 11g database kernel stack.Kernel Data(KD) manages the storage layer for segments and data retrieval as well as formatting operations of database segments for storage of table data and index data.Kernel Transactions (KT) manages freelist operations along with rollback segments including interested transaction list (ITL) allocation for operations that occur within data blocks, undo tasks, and transaction consistency based on the ACID model for relational databases.Kernel Cache (KC) handles operations around the database buffer cache for Oracle 11g. It works hand-in-hand with system functions to manage shared memory resources including the buffer cache and redo log memory operations.Kernel Locking (KJ) provides for lock management for RAC environments. It does not manage single instance non-RAC lock operations.The Kernel Generic layer performs basic database kernel operations.Following is a brief summary of the different kernel services available for review via the x$ tables. First to be examined are the x$ tables around the Kernel Services (KS) layer for Oracle 11g.Oracle 12c 的信息说明:Here is a list of the "important" x$ tables in Oracle 12c:x$activeckpt active checkpoint
x$bh buffer header
x$ckptbuf checkpoint buffer (queue)
x$dbgalertext debug alert extented
x$dbglogext debug log extended
x$dbgricx, x$dbgrifx, x$dbgrikx, x$dbgripx debug tables
x$dbkece debug kernel error, critical error
x$dbkefefc debug kernel error, fatal error flood control
x$dglparam data guard logical parameters
x$diag_alert_ext diagnostics alert extended
x$diag_hm_run, x$diag_vhm_run diagnostics health monitor runs
x$diag_ips_configuration diagnostics incident packaging service configuration
x$dnfs_meta dNFS metadata
x$dra_failure data recovery advisor failures
x$drm_history, x$drm_history_stats dynamic remastering history, stats
x$jskjobq job scheduling ?, job queue
x$k2gte,x$k2gte2 kernel 2-phase commit, global transaction entry
x$kbrpstat kernel backup recovery process(?) statistics
x$kcbbes kernel cache, buffer ?
x$kcbbf kernel cache, buffer buffer_handles
x$kcbfwait kernel cache, buffer file wait
x$kcbkpfs kernel cache, buffer ckpt prefetch statistics
x$kcbkwrl kernel cache, buffer write list
x$kcbldrhist kernel cache, buffer load direct read history
x$kcbobh kernel cache, buffer, objectqueue buffer header
x$kcboqh kernel cache, buffer, object queue header
x$kcbsw kernel cache, buffer statistics why
x$kcbuwhy kernel cache, buffer why
x$kcbwbpd kernel cache, buffer workingset buffer pool descriptor
x$kcbwds kernel cache, buffer workingset descriptors
x$kcbwh kernel cache, buffer where/why
x$kcccf kernel cache, controlfilemanagement control file
x$kcccp kernel cache, controlfile checkpoint progress
x$kccdi kernel cache, controlfilemanagement database information
x$kccle kernel cache, controlfile logfile entry
x$kccnrs, x$kccrsp kernel cache, controlfile non-guaranteed restorepoint; kernel cache, controlfile restore point
x$kcfis* kernel cache, file intelligent scan
x$kclcrst kernel cache, (RAC) lock, consistent read statistics
x$kclfh kernel cache, (RAC) lock file hashtable
x$kclfi kernel cache, (RAC) lock file index
x$kclfx kernel cache, (RAC) lock (element) freelist statistics
x$kcluh kernel cache, (RAC) lock undo header
x$kclui kernel cache, (RAC) lock undo index
x$kcmscn kernel cache, maximum SCN
x$kcrfstrand kernel cache, redo file strand
x$kcrfx kernel cache, redo file context
x$kcrrlns kernel cache, recovery process LNS
x$kdxst kernel data, index status
x$kdxhs kernel data, index histogram
x$kewrtb kernel server (manageability), workload repository tables
x$kfdat kernel file, disk allocation table?
x$kffxp kernel file, file extent map
x$kfklib kernel file, - library
x$kghlu kernel generic, heap LRUs
x$kglcursor kernel generic, librarycache cursor
x$kgllk kernel generic, librarycache lock
x$kglob kernel generic, librarycache object
x$kglpn kernel generic, librarycache pin
x$kglrd kernel generic, librarycache readonly dependency
x$kglst kernel generic, librarycache statistics
x$kgltr kernel generic, librarycache translation
x$kgskvft kernel generic, service, ?? fixed table
x$kjxm kernel RAC cross-instance (?) messaging
x$kjznhangs, x$kjznhangses kernel RAC diag node hang session
x$kmgsct kernel memory, granule scoreboard ?
x$kmgstfr kernel memory, granule - transfer
x$knstmvr kernel replication, statistics materialized view refresh
x$kqdpg kernel query, dictionary PGA
x$kqfco kernel query, fixed table columns
x$kqfdt kernel query, fixed derived table
x$kqfp kernel query, fixed package
x$kqfsz kernel query, fixed size (size of fixed objects in current version of Oracle)
x$kqfta kernel query, fixed table
x$kqfvi kernel query, fixed view
x$kqlfsqce kernel query, librarycache fixedtable sql cursor environment
x$kqrpd kernel query, rowcache parent definition
x$kqrsd kernel query, rowcache subordinate definition
x$krbmsft kernel recovery, - search file ?
x$krcfh, x$krcfde, x$krcfbh, x$krcbit kernel recovery, changetracking file, header, descriptor, bitmap header, bitmap block
x$ksbdd kernel service, background detached (process) definition
x$ksbsrvdt kernel service, background server detached (process)
x$ksbtabact kernel service, background - action
x$ksimsi kernel service, instance management serial (and) instance (numbers)
x$ksipc_info and x$ksipc_proc_stats kernel service IPC info and process stats
x$ksi_reuse_stats kernel service, instance, reuse stats
x$ksled, x$kslei, x$ksles kernel service, lock, event descriptors, events for instance, events for session
x$kslemap kernel service, lock, event map
x$kslhot kernel service, lock, hot (blocks)
x$ksllclass kernel service, lock,, latch class
x$ksllw kernel service, lock, latch where
x$kslpo kernel service, latch posting
x$ksmdd kernel service, memory segmented (array) definition
x$ksmfs kernel service, memory fixed SGA
x$ksmfsv kernel service, memory fixed SGA variables
x$ksmhp kernel service, memory heap
x$ksmjch, x$ksmjs kernel service, memory, java chunks, java (pool) statistics
x$ksmlru kernel service, memory LRU
x$ksmls kernel service, memory large (pool) statistics
x$ksmmem kernel service, memory
x$ksmns kernel service, memory numa (pool) statistics
x$ksmpgdst kernel service, memory PGA detailed statistics
x$ksmpp kernel service, memory pga heap
x$ksmsp kernel service, memory sga heap
x$ksmspr kernel service, memory shared pool reserved
x$ksmsp_dsnew kernel service, memory shared pool, - statistics new
x$ksmsp_nwex kernel service, memory shared pool ?
x$ksmss kernel service, memory sga statistics
x$ksmsst, x$ksmstrs kernel service, memory, sga streams (pool), streams (pool) statistics
x$ksmssinfo kernel service, memory sga OS (level) info
x$ksmup kernel service, memory uga heap
x$ksolsfts kernel service, object level statistics, fts?
x$ksppcv kernel service, parameter, current (session) value
x$ksppi kernel service, parameter, parameter info
x$ksppsv kernel service, parameter, system value
x$kspspfh kernel service, parameter spfile header
x$ksrcctx, x$ksrcdes kernel service, (intra-instance) broadcast, channel context, channel description
x$ksrchdl kernel service, (intra-instance) broadcast, channel ?
x$kstex kernel service, trace execution
x$ksulop kernel service, user long operation
x$ksulv kernel service, user locale value
x$ksupgp, x$ksupgs kernel service, user, process group, process group sniped
x$ksupl, x$ksuru kernel service, user, process (resource) limit, resource usage
x$ksuprlat kernel service, user process latch
x$ksuse kernel service, user session
x$ksusecon kernel service, user session connection
x$ksusm kernel service, user session migration
x$ksuvmstat kernel service, user virtual memory statistics
x$kswsastab kernel service, workgroup services, service table
x$ksxafa kernel service, execution, - file affinity
x$ksxm_dft kernel service, execution, modification dml frequency tracking
x$ksxpclient kernel service, ipc, client
x$ksxpif kernel service, ipc, interface
x$ksxpping kernel service, ipc, ping
x$ksxp_stats kernel service, ipc, stats
x$ktcn* kernel transaction, change notification *
x$ktcxb kernel transaction, control, transaction object
x$ktfbfe kernel tablespace, file bitmap free extent
x$ktfbhc kernel tablespace, file bitmap header control
x$ktfbnstat kernel tablespace, file bigfile - stat
x$ktfbue kernel tablespace, file bitmap used extent
x$ktifb, x$ktiff, x$ktifp, x$ktifv kernel transaction, in-memory flush, ?
x$ktprhist kernel transaction, parallel (transaction) recovery history
x$ktsimapool kernel transaction, - in-memory pool
x$ktsj* kernel transaction, space job(?)
x$ktskstat kernel transaction/tablespace, segment shrink statistics
x$ktslchunk kernel transaction/tablespace, space LOB chunk
x$ktspstat kernel tablespace, space statistics
x$ktsso kernel transaction, sort segment
x$ktugd kernel transaction, undo global data
x$ktuqqry kernel transaction, undo - query
x$kturhist kernel transaction, undo recovery history
x$ktusmst kernel transaction, undo system managed, statistics
x$ktuxe kernel transaction, undo transaction entry
x$kvii, x$kvit kernel (performance) view, instance, initialization, transitory (parameters)
x$kwqbpmt kernel OLTP queue ?
x$kxdbio_stats, x$kxdcm*, x$kxdrs kernel Exadata, block (level) intelligent operations stats, callback for metrics, resilvering
x$kxfbbox kernel execution, fast (parallel process) black box
x$kxfpbs kernel execution, fast (parallel) process batch size
x$kxfpcds, x$kxfpcms, x$kxfpcst kernel execution, fast (parallel) process, coordinator, dequeue stats, message stats, (query) stats
x$kxfpinstload kernel execution, fast (parallel) process instance load
x$kxfpsds, x$kxfpsms, x$kxfpsst kernel execution, fast (parallel) process, slave, dequeue stats, message stats, (query) stats
x$kxsbd kernel execution, SQL bind data
x$kxttstecs, x$kxttstehs, x$kxttsteis, x$kxttstets kernel execution, temporary table stats, column stats, histograms, index stats, table stats
x$kywm* kernel - workload management
x$kzspr, x$kzsro kernel security, session, privilege, role
x$le lock element
x$lobsegstat, x$lobstat, x$logstathist LOB (segment) stats, history
x$logbuf_readhist Log buffer read histogram
x$messages (background process) messages
x$modact_length (sql) module action length (limit)
x$qesmmiwt query execution, sql memory management ?
x$qesmmsga query execution, sql memory management ?
x$qksbgses, x$qksbgsys query compilation service, bug session or system
x$qksceses, x$qkscesys query compilation service, compilation environment, session or system
x$skgxp_connection, x$skgxp_port OS kernel generic interface IPC, connections, ports
x$targetrba target RBA
x$trace trace
x$uganco user global area, network connection
x$xplton, x$xpltoo explain plan sql trace(?) operation name, option
x$xs_sessions ? sessions
x$zasa* ?