Oracle:ORA-01219:database not open:queries allowed on fixed tables/views only

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://icode.blog.csdn.net/article/details/96780927

Oracle:ORA-01219:database not open:queries allowed on fixed tables/views only

也可能是你修改了表空间,修改表空间这里没有

问:

解决 ORA-01219:database not open:queries allowed on fixed tables/views only 需要几步?

答:

4 步

第一步:打开 SQL Plus 连接数据库;

第二步:尝试执行:

alter database open;

肯定没这么简单,查看报错,拷贝报错文件地址。
在这里插入图片描述

第三步:干掉这个文件(其实你可能没有这个文件):

alter database datafile '文件地址' offline drop;

在这里插入图片描述

第四步:再次执行:

alter database open;

在这里插入图片描述

成功:

在这里插入图片描述

展开阅读全文

关于operation valid only when the port is open

09-18

老师交给的任务,下位机是S7-200。运行以后一按按钮就出现“operation valid only when the port is open”,求各位救命。。。。rnrn// aaaDlg.cpp : implementation filern//rnrn#include "stdafx.h"rn#include "aaa.h"rn#include "aaaDlg.h"rn#include "DlgProxy.h"rnrn#ifdef _DEBUGrn#define new DEBUG_NEWrn#undef THIS_FILErnstatic char THIS_FILE[] = __FILE__;rn#endifrnrn/////////////////////////////////////////////////////////////////////////////rn// CAboutDlg dialog used for App Aboutrnrnclass CAboutDlg : public CDialogrnrnpublic:rn CAboutDlg();rnrn// Dialog Datarn //AFX_DATA(CAboutDlg)rn enum IDD = IDD_ABOUTBOX ;rn //AFX_DATArnrn // ClassWizard generated virtual function overridesrn //AFX_VIRTUAL(CAboutDlg)rn protected:rn virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV supportrn //AFX_VIRTUALrnrn// Implementationrnprotected:rn //AFX_MSG(CAboutDlg)rn //AFX_MSGrn DECLARE_MESSAGE_MAP()rn;rnrnCAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)rnrn //AFX_DATA_INIT(CAboutDlg)rn //AFX_DATA_INITrnrnrnvoid CAboutDlg::DoDataExchange(CDataExchange* pDX)rnrn CDialog::DoDataExchange(pDX);rn //AFX_DATA_MAP(CAboutDlg)rn //AFX_DATA_MAPrnrnrnBEGIN_MESSAGE_MAP(CAboutDlg, CDialog)rn //AFX_MSG_MAP(CAboutDlg)rn // No message handlersrn //AFX_MSG_MAPrnEND_MESSAGE_MAP()rnrn/////////////////////////////////////////////////////////////////////////////rn// CAaaDlg dialogrnrnIMPLEMENT_DYNAMIC(CAaaDlg, CDialog);rnrnCAaaDlg::CAaaDlg(CWnd* pParent /*=NULL*/)rn : CDialog(CAaaDlg::IDD, pParent)rnrn //AFX_DATA_INIT(CAaaDlg)rn //AFX_DATA_INITrn // Note that LoadIcon does not require a subsequent DestroyIcon in Win32rn m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);rn m_pAutoProxy = NULL;rnrnrnCAaaDlg::~CAaaDlg()rnrn // If there is an automation proxy for this dialog, setrn // its back pointer to this dialog to NULL, so it knowsrn // the dialog has been deleted.rn if (m_pAutoProxy != NULL)rn m_pAutoProxy->m_pDialog = NULL;rnrnrnvoid CAaaDlg::DoDataExchange(CDataExchange* pDX)rnrn CDialog::DoDataExchange(pDX);rn //AFX_DATA_MAP(CAaaDlg)rn DDX_Control(pDX, IDC_BUTTON1, m_button1);rn DDX_Control(pDX, IDC_MSCOMM1, m_msComm);rn //AFX_DATA_MAPrnrnrnBEGIN_MESSAGE_MAP(CAaaDlg, CDialog)rn //AFX_MSG_MAP(CAaaDlg)rn ON_WM_SYSCOMMAND()rn ON_WM_PAINT()rn ON_WM_QUERYDRAGICON()rn ON_WM_CLOSE()rn ON_BN_CLICKED(IDC_BUTTON1, OnButton1)rn ON_BN_CLICKED(IDC_BUTTON2, OnButton2)rn ON_BN_CLICKED(IDC_BUTTON3, OnButton3)rn ON_BN_CLICKED(IDC_BUTTON4, OnButton5)rn //AFX_MSG_MAPrnEND_MESSAGE_MAP()rnrn/////////////////////////////////////////////////////////////////////////////rn// CAaaDlg message handlersrnrnBOOL CAaaDlg::OnInitDialog()rnrn CDialog::OnInitDialog();rnrn // Add "About..." menu item to system menu.rnrn // IDM_ABOUTBOX must be in the system command range.rn ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);rn ASSERT(IDM_ABOUTBOX < 0xF000);rnrn CMenu* pSysMenu = GetSystemMenu(FALSE);rn if (pSysMenu != NULL)rn rn CString strAboutMenu;rn strAboutMenu.LoadString(IDS_ABOUTBOX);rn if (!strAboutMenu.IsEmpty())rn rn pSysMenu->AppendMenu(MF_SEPARATOR);rn pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);rn rn rnrn // Set the icon for this dialog. The framework does this automaticallyrn // when the application's main window is not a dialogrn SetIcon(m_hIcon, TRUE); // Set big iconrn SetIcon(m_hIcon, FALSE); // Set small iconrn rn // TODO: Add extra initialization herern rn return TRUE; // return TRUE unless you set the focus to a controlrnm_msComm.SetCommPort(1);//使用的串口号rnm_msComm.SetSettings("9600,N,8,1");//设定通讯格式rnm_msComm.SetRThreshold(40);//设置接收缓冲区大小rnm_msComm.SetSThreshold(1);rnm_msComm.SetInputLen(0);rnm_msComm.SetInputMode(1);//设置通讯模式rnm_msComm.SetPortOpen(TRUE);//打开串口rnm_msComm.SetRTSEnable(TRUE);rnm_msComm.SetNullDiscard(FALSE);rnrnrnvoid CAaaDlg::OnSysCommand(UINT nID, LPARAM lParam)rnrn if ((nID & 0xFFF0) == IDM_ABOUTBOX)rn rn CAboutDlg dlgAbout;rn dlgAbout.DoModal();rn rn elsern rn CDialog::OnSysCommand(nID, lParam);rn rnrnrn// If you add a minimize button to your dialog, you will need the code belowrn// to draw the icon. For MFC applications using the document/view model,rn// this is automatically done for you by the framework.rnrnvoid CAaaDlg::OnPaint() rnrn if (IsIconic())rn rn CPaintDC dc(this); // device context for paintingrnrn SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);rnrn // Center icon in client rectanglern int cxIcon = GetSystemMetrics(SM_CXICON);rn int cyIcon = GetSystemMetrics(SM_CYICON);rn CRect rect;rn GetClientRect(&rect);rn int x = (rect.Width() - cxIcon + 1) / 2;rn int y = (rect.Height() - cyIcon + 1) / 2;rnrn // Draw the iconrn dc.DrawIcon(x, y, m_hIcon);rn rn elsern rn CDialog::OnPaint();rn rnrnrn// The system calls this to obtain the cursor to display while the user dragsrn// the minimized window.rnHCURSOR CAaaDlg::OnQueryDragIcon()rnrn return (HCURSOR) m_hIcon;rnrnrn// Automation servers should not exit when a user closes the UIrn// if a controller still holds on to one of its objects. Thesern// message handlers make sure that if the proxy is still in use,rn// then the UI is hidden but the dialog remains around if itrn// is dismissed.rnrnvoid CAaaDlg::OnClose() rnrnUINT nRet=MessageBox(_T("直接退出程序?"),_T("!"),MB_YESNO);rnif (nRet!=IDYES)rnrnreturn;rnrnCDialog::OnClose();rnrnrnvoid CAaaDlg::OnOK() rnrn if (CanExit())rn CDialog::OnOK();rnrnrnvoid CAaaDlg::OnCancel() rnrn if (CanExit())rn CDialog::OnCancel();rnrnrnBOOL CAaaDlg::CanExit()rnrn // If the proxy object is still around, then the automationrn // controller is still holding on to this application. Leavern // the dialog around, but hide its UI.rn if (m_pAutoProxy != NULL)rn rn ShowWindow(SW_HIDE);rn return FALSE;rn rnrn return TRUE;rnrnrnBEGIN_EVENTSINK_MAP(CAaaDlg, CDialog)rn //AFX_EVENTSINK_MAP(CAaaDlg)rn ON_EVENT(CAaaDlg, IDC_MSCOMM1, 1 /* OnComm */, OnOnCommMscomm1, VTS_NONE)rn //AFX_EVENTSINK_MAPrnEND_EVENTSINK_MAP()rnrnvoid CAaaDlg::OnOnCommMscomm1() rnrn long numu;rn long numl;rn // TODO: Add your control notification handler code herern COleVariant varRcv;rnswitch(m_msComm.GetCommEvent())rn rn case 2:rn varRcv = m_msComm.GetInput();rn varRcv.ChangeType(VT_ARRAY|VT_UI1);rn char* pbstr;rn HRESULT hru,hrl;rn hru = SafeArrayAccessData(varRcv.parray,(void**)&pbstr); if(FAILED(hru))rn rn AfxMessageBox("获取PLC指针数组失败!");rn break;rn rn hru = SafeArrayGetUBound(varRcv.parray,1,&numu);rn if(FAILED(hru))rn rn AfxMessageBox("获取PLC指针数组上界失败!");rn break;rn rn hrl = SafeArrayGetLBound(varRcv.parray,1,&numl);rn if(FAILED(hrl))rn rn AfxMessageBox("获取PLC指针数组下界失败!");rn break;rn rn int i;rn for(i=0 ; i<(numu-numl+1) ; i++)rn rn//接收数据处理rn rn SafeArrayUnaccessData(varRcv.parray);rn break;rnrnCByteArray bytOutArr;rnCOleVariant varOut = COleVariant(bytOutArr);rn m_msComm.SetOutput(varOut);//发送通讯数据rnm_msComm.SetPortOpen(FALSE);rnrnrnvoid CAaaDlg::OnButton1() rnrnCByteArray Array;rn Array.RemoveAll();rn Array.SetSize(2);rn Array.SetAt(0,00000001);rnm_msComm.SetOutput(COleVariant(Array)); // TODO: Add your control notification handler code herernrnrnvoid CAaaDlg::OnButton2() rnrn // TODO: Add your control notification handler code herernCByteArray Array;rn Array.RemoveAll();rn Array.SetSize(2);rn Array.SetAt(0,00000010);rnm_msComm.SetOutput(COleVariant(Array)); rnrnrnvoid CAaaDlg::OnButton3() rnrnCByteArray Array;rn Array.RemoveAll();rn Array.SetSize(2);rn Array.SetAt(0,00000011);//发送数据rnm_msComm.SetOutput(COleVariant(Array)); // TODO: Add your control notification handler code herern rnrnrnvoid CAaaDlg::OnButton4() rnrn // TODO: Add your control notification handler code herern rnrnrnvoid CAaaDlg::OnButton5() rnrnCAboutDlg dlg;rndlg.DoModal(); // TODO: Add your control notification handler code herern rnrnrnrnrnrnrn[img=https://img-bbs.csdn.net/upload/201409/18/1411010388_336592.png][/img]rn编译没有问题,就是点击按钮以后会出现“operation valid only when the port is open” 论坛

alter database open resetlogs的问题

04-23

我今天学习了一下oracle RMAN的备份恢复,就是删除数据文件和控制文件,保留日志文件的恢复。遇到一个问题。就是在操作的最后一部分,及alter database open 报错,说必须使用alter database open resetlogs打开。可是我认为应该使用alter database open 打开,不知道是什么原因。请大侠帮助。rnrn数据库处于归档模式下,做数据库联机备份,并且RMAN的参数是使用快闪恢复区作为备份文件的存储目录rn,配置了控制文件自动备份。rnrn1、使数据库处于归档模式rnC:\Documents and Settings\Administrator>sqlplus /nologrnSQL> conn sys/ysyy@ahufgov as sysdba;rnSQL> archive log list;rnSQL> shutdown immediaternSQL> startup mountrnSQL> alter database archivelog;rnSQL> alter database open;rnSQL> archive log list;rnrn2、查看快闪恢复区参数rnC:\Documents and Settings\Administrator>sqlplus /nologrnSQL> conn sys/ysyy@ahufgov as sysdba;rnSQL> show parameter db_recovery_file_dest;rnrn3、配置控制文件自动存档rnC:\Documents and Settings\Administrator>rman target system/ysyy@ahufgovrnRMAN> show all;rnRMAN> configure controlfile autobackup on;rnRMAN> show all;rnrnrnrn数据文件、控制文件丢失的恢复,日志文件保存良好。rnrn数据库联机备份rnC:\Documents and Settings\Administrator>rman target rman/ysyy@ahufgovrnRMAN> backup as compressed backupset database plus archivelog delete all input;rnrn备份数据库后,为了演示备份后是否有数据丢失,我们在system用户下,创建两张表,并插入数据。rnC:\Documents and Settings\Administrator>sqlplus /nologrnSQL> conn system/ysyy@ahufgovrnSQL> create table testa as select * from dba_segments;rnSQL> select count(*) from testa;rnSQL> create table testb (id int,name varchar2(18));rnSQL> insert into testb values ('1','zhangsan');rnSQL> insert into testb values ('1','zhangsan');rnSQL> insert into testb values ('1','zhangsan');rnSQL> insert into testb values ('1','zhangsan');rnSQL> insert into testb values ('1','zhangsan');rnC:\Documents and Settings\Administrator>sqlplus sys/ysyy@ahufgov as sysdba;rnSQL> shutdown immediatern删除D:\app\Administrator\oradata\ahufgov下所有的数据文件、控制文件,保留日志文件。rnrnC:\Documents and Settings\Administrator>rman target rman/system@ahufgovrnRMAN> startuprnRMAN> restore controlfile from rnrn'D:\app\Administrator\flash_recovery_area\ahufgov\AUTOBACKUP\2013_04_23rnrn\O1_MF_S_813491555_8QCTC56T_.BKP';rnRMAN> startup mount;rnRMAN> restore database;rnRMAN> recover database;rnRMAN> sql 'alter database open resetlogs';----在这里应该使用RMAN> sql 'alter database open';rn----------查看测试结果----------------rnC:\Documents and Settings\Administrator>sqlplus system/ysyy@ahufgovrnSQL> select count(*) from testa;rnrn COUNT(*)rn----------rn 6014rnrnSQL> select count(*) from testb;rnrn COUNT(*)rn----------rn 5rnRMAN> sql 'alter database open resetlogs';----在这里应该使用RMAN> sql 'alter database open';rn----------查看测试结果---------------- 论坛

Android Sqlite database not open错误

07-21

我一共写了三个类如下:rn第一个继承SQLiteOpenHelper:rnpublic class DatabaseHelper extends SQLiteOpenHelperrn private static final int VERSION=1;rn public DatabaseHelper(Context context,String Databasename,CursorFactory factory,int version)rn super(context,Databasename,factory,version);rn /*this.tableName=tableName;*/rn rn public DatabaseHelper(Context context,String DatabaseName)rn this(context,DatabaseName,null,VERSION);rn rn @Overridern public void onCreate(SQLiteDatabase db) rn // TODO Auto-generated method stubrn String sql="create table "+"book"+" (id integer primary key autoincrement,name varchar(10),content text,time date)";rn System.out.print(sql);rn Log.e("sql",sql);rn db.execSQL(sql);rn db.close();rn rnrn @Overridern public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) rn // TODO Auto-generated method stubrn rn rn rnrn第二个类实现对数据库的简单操作:rnpublic class dbDao rn private DatabaseHelper helper;rn public dbDao(Context context,String DatabaseName)rn this.helper=new DatabaseHelper(context,DatabaseName); rn /*SQLiteDatabase db=helper.getReadableDatabase();*/rn rn public void createTable(String sql)rn SQLiteDatabase db=helper.getWritableDatabase();rn db.execSQL(sql);rn db.close();rn this.helper.close();rn rn public String exeQuery(String sql)rn SQLiteDatabase db=this.helper.getReadableDatabase();rn Cursor cursor=db.rawQuery(sql,null);rn StringBuffer buffer=new StringBuffer();rn while(cursor.moveToNext())rn buffer.append(cursor.getInt(0)).append(" ").append(cursor.getString(1)).append(" ")rn .append(cursor.getString(2)).append(" ").append(cursor.getString(3));rn rn cursor.close();rn db.close();rn this.helper.close();rn return buffer.toString();rn rn public void exeDo(String sql)rn SQLiteDatabase db=this.helper.getWritableDatabase();rn db.execSQL(sql);rn this.helper.close();rn db.close();rn rnrn第三个继承Activity:rnpublic class TestSQLite extends Activity rn private TextView selectResult;rn private Button select;rn private Button insert;rn private Button delete;rnrn @Overridern protected void onCreate(Bundle savedInstanceState) rn // TODO Auto-generated method stubrn super.onCreate(savedInstanceState);rn setContentView(R.layout.test_sqlite);rn selectResult = (TextView) findViewById(R.id.selectResult);rn select = (Button) findViewById(R.id.selcet);rn insert = (Button) findViewById(R.id.insert);rn delete = (Button) findViewById(R.id.delete);rn rn select.setOnClickListener(new OnClickListener() rnrn @Overridern public void onClick(View v) rn // TODO Auto-generated method stubrn dbDao database = new dbDao(TestSQLite.this, "test");rn database.exeQuery("select * from book");rnrn rn );rn insert.setOnClickListener(new OnClickListener() rnrn @Overridern public void onClick(View v) rn // TODO Auto-generated method stubrn dbDao database = new dbDao(TestSQLite.this, "test");rn database.exeDo("insert into book value(null,'小明','小明的书','2014-7-18')");rnrn rn );rn delete.setOnClickListener(new OnClickListener() rnrn @Overridern public void onClick(View v) rn // TODO Auto-generated method stubrn dbDao database = new dbDao(TestSQLite.this, "test");rn database.exeDo("delete from book where id=1");rnrn rn );rn rnrn 论坛

This form of method call only allowed in methods of derived types

07-24

unit Unit1;rnrninterfacernrnusesrn Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,rn Dialogs, StdCtrls;rnrntypern TForm1 = class(TForm)rn ListBox1: TListBox;rn Button1: TButton;rn procedure FormCreate(Sender: TObject);rn procedure FormClick(Sender: TObject);rn privatern Persons:array[1..4] of TPerson;rn publicrn Public declarations rn end;rnrnvarrn Form1: TForm1;rnrnimplementationrnrn$R *.dfmrnrnprocedure TForm1.FormCreate(Sender: TObject);rnbeginrn Persons[1]:TBoss.Create('赵晓光',800.0);rn Persons[2]:TEmployee.Create('钱明',400.0,3.0,150);rn Persons[3]:TPieceWorker.Create('孙正',2.5,200);rn Persons[4]:THourlyWorker.Create('李大',13.75,50.0);rnend;rnrnprocedure TForm1.FormDestory(Sender:TObject);rnvarrn i:Integer;rnbeginrn for i:=1 to 4 do beginrn Persons[i].Free;rn Persons[i]:=nil;rn end;rnend;rnrnprocedure TForm1.FormClick(Sender: TObject);rnvarrn i:Integer;rnbeginrn for i:=1 to 4 dorn ListBox1.Items.Add(Format('%8s %10.2f',[Person[i].Name,Person[i].Earnings]));rnend;rnrnend.rnrnrnunit untPerson;rnrninterfacernrntypern TPerson=classrn privatern FName:string;rn publicrn constructor Create(NameValue:string);rn function Earnings:Real;virtual;abstract;rn property Name:string read FName write FName;rn end;rnrnimplementationrnrnconstructor TPerson.Create(NameValue:string);rnbeginrn FName:=NameValue;rnend;rnend.rnrntypern TBoss=class(TPerson)rn privatern FSalary:Real;rn publicrn constructor Create(NameValue:string;SalaryValue:Real);rn function Earnings:Real;override;rn property WeeklySalary:Real read FSalary write FSalary;rn end;rnimplementationrnrnusesrn SysUtils;rnrnconstructor Create(NameValue:string;SalaryValue:Real);rnbeginrn inherited Create(NameValue);rn WeeklySalary:=SalaryValue;rnend;rnrnfunction TBoss.Earnings:Real;rnbeginrn Result:=WeeklySalary;rnend;rnend.rnrnrnunit untPieceWork;rnrninterfacernrnusesrn untPerson;rnrntypern TPieceWorker=class(TPerson)rn privatern FQuantity:Integer;rn FWagePerPiece:Real;rn publicrn constructor Create(NameValue:string;WagePerPieceValue:Real;QuantityValue:Integer);rn function Earnings:Real;override;rn property WagePerPiece:Real read FWagePerPiece write FWagePerPiece;rn property Quantity:Real read FQuantity write FQuantity;rn end;rnrnimplementationrnrnconstructor Create(NameValue:string;WagePerPieceValue:Real;QuantityValue:Integer);rnbeginrn inherited Create(NameValue);rn WagePerPiece:=WagePerPieceValue;rn Quantity:=QuantityValue;rnend;rnrnfunction TPieceWorker.Earnings:Real;rnbeginrn Result:=WagePerPiece*Quantity;rnend;rnend.rnrnunit untEmployee;rnrninterfacernrnusesrn untPerson;rnrntypern TEmployee=class(TPerson)rn privatern FQuantity:Integer;rn FWagePerItem:Real;rn FSalary:Real;rn publicrn constructor Create(NameValue:string;SalaryValue,WageperItemValue:Real;QuantityValue:Integer);rn function Earnings:Real;override;rn property WeeklySalary:Real read FSalary write FSalary;rn property WagePerItem:Real read FWagePerItem write FWagePerItem;rn property Quantity:Integer read FQuantity write FQuantity;rn end;rnrnimplementationrnrnconstructor Create(NameValue:string;SalaryValue,WageperItemValue:Real;QuantityValue:Integer);rnbeginrn inherited Create(NameValue);rn WeeklySalary:=SalaryValue;rn WageperItem:=WageperItemValue;rn Quantity:=QuantityValue;rnend;rnrnfunction TEmployee.Earnings:Real;rnbeginrn Result:=WeeklySalary+WagePerItem*Quantity;rnend;rnend.rnrnrnunit untHourlyWorker;rnrninterfacernrnusesrn untPerson;rnrntypern THourlyWorker=class(TPerson)rn privatern FHourWorked:Real;rn FWage:Real;rn publicrn constructor Create(NameValue:string;WageValue,HourWorkedValue:Real);rn function Earnings:Real;override;rn property Wage:Real read FWage write FWage;rn property HourWorked:Real read FHourWorked write FHourWorked;rn end;rnrnimplementationrnrnconstructor Create(NameValue:string;WageValue,HourWorkedValue:Real);rnbeginrn inherited Create(NameValue);rn Wage:=WageValue;rn HourWorked:=HourWorkedValue;rnend;rnrnfunction THourlyWorker.Earnings:Real;rnbeginrn if HoursWorked<=40 thenrn Result:=Wage*HoursWorked;rn elsern Result:=Wage*40+Wage*1.5*(HoursWorked-40);rnend;rnend.rnrn运行时错误提示如下:rn[Error] untBoss.pas(22): Undeclared identifier: 'Create'rn [Error] untBoss.pas(24): This form of method call only allowed in methods of derived typesrn [Error] untBoss.pas(24): Not enough actual parametersrn [Error] untBoss.pas(25): Undeclared identifier: 'WeeklySalary'rn [Error] untBoss.pas(13): Unsatisfied forward or external declaration: 'TBoss.Create'rn [Fatal Error] Project1.dpr(9): Could not compile used unit 'untBoss.pas'rn 论坛

没有更多推荐了,返回首页