10046 解决 Oracle error

How to Offline a PDB Datafile in NOARCHIVELOG mode CDB which is not Open in Read Write (Doc ID 2240730.1)

1. pdb 下的datafile 只能在pdb下操作,不能在cdb下操作


For the purposes of this document, the following fictitious environment is used as an example to describe the procedure:

Container Database Name: CDB1
Pluggable Database Names: PDB1
Datafile Name: /tmp/STATSPACK.dbf

*********************

Attempt to offline a datafile results in error when the database is running in NOARCHIVELOG mode and is not open in read write mode: 

SQL> alter database datafile '/tmp/STATSPACK.dbf' offline;
alter database datafile '/tmp/STATSPACK.dbf' offline
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01219: database or pluggable database not open: queries allowed on fixed
tables or views only

Changes

Unable to open the CDB, when one of the datafiles, belonging to PDB is missing from the filesystem.

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 23 - see DBWR trace file
ORA-01110: data file 23: '/tmp/STATSPACK.dbf'

But I cannot offline the datafile:

SQL> select name, open_mode from v$pdbs;

NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB$SEED
MOUNTED

PDB1
MOUNTED

SQL> alter session set container=PDB1;

Session altered.

SQL> alter database datafile '/tmp/STATSPACK.dbf' offline;
alter database datafile '/tmp/STATSPACK.dbf' offline
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01219: database or pluggable database not open: queries allowed on fixed
tables or views only

Cause

To determine the cause, enable 10046 trace event and try to offline the datafile:

alter session set tracefile_identifier='event_10046';
alter session set events '10046 trace name context forever,level 12';
alter database datafile '/tmp/STATSPACK.dbf' offline;

Review the trace file generated by the 10046 event.  

Processing Oradebug command 'setmypid'

*** 2017-02-21T13:36:28.630992+01:00 (PDB1(3))
Oradebug command 'setmypid' console output: <none>

*** 2017-02-21T13:36:38.063286+01:00 (PDB1(3))
Processing Oradebug command 'EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12'   +++++++++ 10046 trace event at level 12

*** 2017-02-21T13:36:38.121570+01:00 (PDB1(3))
Oradebug command 'EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12' console output: <none>
WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=198174189201

*** 2017-02-21T13:36:43.936339+01:00 (PDB1(3))
WAIT #0: nam='SQL*Net message from client' ela= 5814615 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=198180003894
WAIT #0: nam='Disk file operations I/O' ela= 17 FileOperation=8 fileno=0 filetype=8 obj#=-1 tim=198180004004

*** 2017-02-21T13:36:43.936438+01:00 (PDB1(3))
Processing Oradebug command 'TRACEFILE_NAME'

*** 2017-02-21T13:36:43.936469+01:00 (PDB1(3))
Oradebug command 'TRACEFILE_NAME' console output:
/u01/app/oracle/diag/rdbms/cdb1/CDB1/trace/CDB1_ora_32744.trc
WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=198180004067

*** 2017-02-21T13:36:51.167762+01:00 (PDB1(3))
WAIT #0: nam='SQL*Net message from client' ela= 7231241 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=198187235319
XCTEND rlbk=0, rd_only=1, tim=198187235540

*** 2017-02-21T13:36:51.168323+01:00 (CDB$ROOT(1))
=====================
PARSING IN CURSOR #140359700677696 len=248 dep=1 uid=0 oct=3 lid=0 tim=198187235894 hv=1954812753 ad='7b67d9c8' sqlid='6qpmyqju884uj'
select ruletyp#, ruleval, status, ltime from lockdown_prof$ where prof#=:1 and level#=:2 order by ltime
END OF STMT
PARSE #140359700677696:c=0,e=130,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,plh=0,tim=198187235890
=====================
PARSE ERROR #140359700677696:len=249 dep=1 uid=0 oct=3 lid=0 tim=198187236029 err=1219
select ruletyp#, ruleval, status, ltime from lockdown_prof$    +++++++++++++++++ error while performing select operation on lockdown_prof$

Information in trace file shows that there is a lockdown profile.  Thus any command will attempt to read the lockdown_prof$ table in CDB$ROOT.  This will wait as the CDB$ROOT is not open.

In other words, an ORA-01219 error raised for any command when:


1) CDB is not opened 
AND
2) a lockdown profile is set at CDB level

Solution

 Set pdb_lockdown= Null and attempt to offline/drop the datafile:

SQL> alter system set pdb_lockdown='';

System altered.

SQL> alter session set container=pdb1;

Session altered.

SQL> alter database datafile 23 offline for drop; Database altered.

Database altered.

SQL> alter session set container=cdb$root;

Session altered.

SQL> alter database open;

Database altered.

1.252 PDB_LOCKDOWN

PDB_LOCKDOWN determines the PDB lockdown profile that applies to a PDB.

PropertyDescription

Parameter type

String

Syntax

PDB_LOCKDOWN = pdb-lockdown-profile-name

Default value

NULL

Modifiable

ALTER SESSIONALTER SYSTEM

Modifiable in a PDB

Yes

Basic

No

Oracle RAC

All instances should have the same value

A PDB lockdown profile is a mechanism to restrict operations (such as setting values of certain parameters and using certain options) that can be performed by users connected to a given PDB. You can also restrict execution of any packages that allow network access, for example, UTL_SMTP.

You create lockdown profiles using the SQL CREATE LOCKDOWN PROFILE statement. Then you can set a profile using the SQL ALTER SESSION or ALTER SYSTEM statement. See the Examples section.

This parameter can be set using the ALTER SYSTEM statement with scope set to MEMORYSPFILE, or BOTH.

The lockdown profile for PDBs can be specified by a common user with common ALTER SYSTEM or common SYSDBA privilege.

If a PDB lockdown profile is dropped, any PDB to which the dropped profile was assigned (by means of storing the dropped profile name in the PDB_LOCKDOWN parameter) will continue to have its PDB_LOCKDOWN parameter set to the dropped lockdown profile name. However, the PDB will not have any restrictions imposed by the dropped lockdown profile.

Lockdown profiles can now be created in an application root and are referred to as application lockdown profiles.

A CDB common user with common SYSDBA or common ALTER SYSTEM privilege can only set PDB_LOCKDOWN to a CDB lockdown profile. Similarly, an application common user with application common SYSDBA or application common ALTER SYSTEM privilege can only set PDB_LOCKDOWN to an application lockdown profile.

An application common user cannot overwrite PDB_LOCKDOWN if PDB_LOCKDOWN is already set to a CDB lockdown profile in an application root or application PDB.

If the PDB_LOCKDOWN parameter in a PDB is set to the name of a lockdown profile different from that in its ancestor (for a CDB, the CDB root or, for application PDBs, the application root), the following will govern the interaction between restrictions imposed by these profiles:

  • If the PDB_LOCKDOWN parameter in a PDB (including an application PDB) is set to a CDB lockdown profile, lockdown profiles specified by the PDB_LOCKDOWN parameter in CDB root (and for application PDBs, the application root) are ignored.

  • If the PDB_LOCKDOWN parameter in an application PDB is set to an application lockdown profile while the PDB_LOCKDOWN parameter in the application root or CDB root is set to a CDB lockdown profile, in addition to the rules stipulated in the application lockdown profile, the DISABLE rules from the CDB lockdown profile set in its nearest ancestor (that is, an application root or CDB root) are inherited.

  • If there are conflicts between rules comprising the CDB lockdown profile and the application lockdown profile, the rules in the CDB lockdown profile will take precedence (for example, the OPTION_VALUE clause of a CDB lockdown profile will take precedence over the OPTION_VALUE clause of an application lockdown profile).

Examples

This example shows how the SYS user can connect to the database AS SYSDBA and use the CREATE LOCKDOWN PROFILE statement in the root of a CDB to define a new lockdown profile. After defining the new lockdown profile, the SYS user can assign the new lockdown profile to a PDB using the PDB_LOCKDOWN parameter:

Copy

SQL> ALTER SESSION SET CONTAINER=CDB$ROOT; Session altered. SQL> CREATE LOCKDOWN PROFILE MYPROFILE; Lockdown Profile created. SQL> ALTER SESSION SET CONTAINER=CDB1_PDB1; Session altered. SQL> ALTER SYSTEM SET PDB_LOCKDOWN=MYPROFILE; System altered. SQL> SHOW PARAMETER PDB_LOCKDOWN NAME TYPE VALUE -------------- ----------- --------- pdb_lockdown string MYPROFILE SQL>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/diannao/90195.shtml
繁体地址,请注明出处:http://hk.pswp.cn/diannao/90195.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

在HP暗影精灵Ubuntu20.04上修复IntelAX211Wi-Fi不可用的全过程记录——系统安装以后没有WIFI图标无法使用无线网

在 HP 暗影精灵 Ubuntu 20.04 上修复 Intel AX211 Wi-Fi 不可用的全过程记录 2025 年 7 月初 系统环境&#xff1a;HP OMEN&#xff08;暗影精灵&#xff09;笔记本 | 双系统 Windows 11 & Ubuntu 20.04 | 内核 5.15 / 6.15 mainline 问题关键词&#xff1a;Intel AX21…

Sql server 中关闭ID自增字段(SQL取消ID自动增长)

sql server在导入数据的时候&#xff0c;有时候要考虑id不变&#xff0c;就要先取消自动增长再导入数据&#xff0c;导完后恢复自增。 比如网站改版从旧数据库导入新数据库&#xff0c;数据库结构不相同&#xff0c;可能会使用insert into xx select ..from yy的语句导入数据。…

Python实现文件夹中文件名与Excel中存在的文件名进行对比,并进行删除操作

以下python程序版本为Python3.13.01.请写一个python程序&#xff0c;实现以下逻辑&#xff1a;从文件夹获取所有文件名&#xff0c;与Excel中的fileName列进行对比&#xff0c;凡是不在该文件夹下的文件名&#xff0c;从Excel文档中删除后&#xff0c;并将Excel中fileName和fil…

广告业务动态查询架构设计:从数据建模到可视化呈现

在数字化营销领域&#xff0c;广告主每天面临着海量数据带来的分析挑战&#xff1a;从账户整体投放效果&#xff0c;到分渠道、分地域的精细化运营&#xff0c;每一层级的数据洞察都需要灵活高效的查询能力。我们的广告业务动态查询系统&#xff0c;正是为解决这类需求而生 &am…

pytorch、torchvision与python版本对应关系

pytorch、torchvision与python版本对应关系 可以查看官网&#xff1a; https://github.com/pytorch/vision#installation

【机器学习笔记 Ⅲ】3 异常检测算法

异常检测算法&#xff08;Anomaly Detection&#xff09;详解 异常检测是识别数据中显著偏离正常模式的样本&#xff08;离群点&#xff09;的技术&#xff0c;广泛应用于欺诈检测、故障诊断、网络安全等领域。以下是系统化的解析&#xff1a;1. 异常类型类型描述示例点异常单个…

【ssh】在 Windows 上生成 SSH 公钥并实现免密登录 Linux

在 Windows 上生成 SSH 公钥并实现免密登录 Linux&#xff0c;可以使用 ssh-keygen 命令&#xff0c;这是 Windows 10 和 Windows 11 中默认包含的 OpenSSH 工具的一部分。下面是详细步骤&#xff1a; 在 Windows 上生成 SSH 公钥 打开 PowerShell 或命令提示符&#xff1a; 在…

MS51224 一款 16 位、3MSPS、双通道、同步采样模数转换器(ADC)

MS51224 是一款 16 位、3MSPS、双通道、同步采样模数转换器&#xff08;ADC&#xff09;&#xff0c;具有集成的内部参考和参考电压缓冲器。芯片可由 5V 单电源供电&#xff0c;支持单极性和全差分模拟信号输入&#xff0c;具有出色的直流和交流性能。芯片模拟输入信号频率高达…

WPF学习(四)

文章目录一、用户控价1.1 依赖属性的注册1.2 具体使用一、用户控价 1.1 依赖属性的注册 using System.Windows; using System.Windows.Controls;namespace WpfApp {public partial class MyUserControl : UserControl{// 依赖属性&#xff1a;外部可绑定的文本public static …

vue3+typescript项目配置路径别名@

1. vite.config.ts配置//方法1 import { defineConfig } from vite; import vue from vitejs/plugin-vue; import path from path;export default defineConfig({plugins: [vue()],resolve: {alias: {: path.resolve(__dirname, src)}} });//方法2,需要执行npm install -D type…

MySql 常用SQL语句、 SQL优化

✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨SQL语句主要分为哪几类 SQL&#xff08;结构化查询语言&#xff09;是用于管理和操作关系型数据库的标准语言&#xff0c;其语句通常根据功能划分为以下几大类&#xff0c;每类包含不同的子句和命令&#xff0c;用于实现特定的数据库操作需求&am…

代理模式实战指南:打造高性能RPC调用与智能图片加载系统

代理模式实战指南&#xff1a;打造高性能RPC调用与智能图片加载系统 &#x1f31f; 嗨&#xff0c;我是IRpickstars&#xff01; &#x1f30c; 总有一行代码&#xff0c;能点亮万千星辰。 &#x1f50d; 在技术的宇宙中&#xff0c;我愿做永不停歇的探索者。 ✨ 用代码丈量…

登山第二十六梯:单目3D检测一切——一只眼看世界

文章目录 一 摘要 二 资源 三 内容 一 摘要 尽管深度学习在近距离 3D 对象检测方面取得了成功&#xff0c;但现有方法难以实现对新对象和相机配置的零镜头泛化。我们介绍了 DetAny3D&#xff0c;这是一种可提示的 3D 检测基础模型&#xff0c;能够在任意相机配置下仅使用单目…

ROS2简记一:第一个ros2程序,海龟模拟与C++和python的《你好,世界!》

目录 引言 一、控制小海龟 二、键盘控制海龟 三、控制海龟案例的简单分析 四、ROS2之linux基础 4.1 linux终端命令 4.1.1 查看当前终端所在目录 pwd 4.1.2 切换终端所在目录 cd 4.1.3 查看当前目录下的文件 ls 4.1.4 主目录 ~ 4.1.5 文件的操作 4.1.6 命令使用帮助…

监控的基本理论和prometheus安装

监控的基本理论和prometheus安装 前言 这篇博客主要讲的是关于理论的知识&#xff0c;大家尽可能的消化和吸收&#xff0c;也能扩展大家的知识面 监控的基本概念 监控俗称为运维的第三只眼。没有了监控&#xff0c;业务运维都是“瞎子”。所以说监控室运维这个职业的根本&…

互联网生态下赢家群体的崛起与“开源AI智能名片链动2+1模式S2B2C商城小程序“的赋能效应

摘要&#xff1a;本文聚焦未来互联网赢家群体的构成特征&#xff0c;剖析网红经济与专业主播的差异化发展路径&#xff0c;结合开源AI智能名片链动21模式与S2B2C商城小程序的融合创新&#xff0c;提出技术赋能下互联网商业生态的重构路径。研究表明&#xff0c;开源AI技术通过智…

OneCode 图表组件核心优势解析

一、全方位的可视化能力 OneCode 图表组件提供了15种专业图表类型&#xff0c;覆盖从基础到高级的数据可视化需求&#xff1a; 基础图表&#xff1a;柱状图、折线图、饼图、面积图等高级图表&#xff1a;金字塔图、雷达图、仪表盘、LED图表等实时图表&#xff1a;实时折线图、实…

【Linux】RHCE中ansible的配置

1.安装并配置ansible 第一步先安装ansible所需软件 #安装ansible所需软件 [devopsworkstation ~]$ sudo dnf install ansible ansible-navigator rhel-system-roles -y 第二步登录镜像仓库&#xff0c;在镜像仓库下载镜像容器来运行ansible 由于ansible-navigator 知ansible…

ubuntu server系统 安装宝塔

更新系统软件包sudo apt update && sudo apt upgrade -y提示&#xff0c;如果想博主这样是存绿色liunx系统&#xff0c;要先安装python3脚本才可以python3 --version有pyhton版本号就是安装了&#xff0c;没有的话就要安装安装 Pythonsudo apt update sudo apt install…

用C++实现五子棋游戏

#include <iostream> #include <vector> #include <string> #include <iomanip> // 用于控制输出格式 #include <limits> // 用于numeric_limitsusing namespace std;// 游戏常量定义 const int BOARD_SIZE 15; // 定义棋盘大小为15x15// 棋…