用户已被授予CREATE SESSION
,但我只能连接到 CDB 而不是 PDB。为什么是这样?我正在 SQL 开发人员中尝试这个。我有甲骨文 19c。
ellie-lumen's questions
为清楚起见,对问题进行了编辑。
目标:在 Windows 10 上安装 Oracle 19c 并制作 PDB。
背景:我在 2 台计算机上错误地安装了 Oracle(将 oracle 19c 文件解压缩为C:\App\db_home1
,而不是C:\App\oracle\product\19.3\db_home1
)。我尝试通过卸载来解决此问题(按照以下说明手动操作:https ://www.youtube.com/watch?v=EHFbk_6ThAQ )。现在我正在尝试重新安装。
在计算机 1 上重新安装时出现问题:
当我运行 setup.exe 时,我在安装步骤中收到错误消息[INS-20802] Oracle Database Configuration Assistant Failed
。
当我打开“installActions2020-09-05_03-48-30PM”时,底部出现此错误:INFO: [Sep 5, 2020 4:38:02 PM] [FATAL] Error while executing "C:\App\oracle\product\19.3\db_home1\rdbms\admin\dbmssml.sql". Refer to "C:\App\oracle\cfgtoollogs\dbca\orclglobal\dbmssml0.log" for more details. Error in Process: C:\App\oracle\product\19.3\db_home1\perl\bin\perl.exe
当我去的时候C:\App\oracle\cfgtoollogs\dbca\orclglobal\dbmssml0.log
,它是空白的。
尝试乔的建议:
C:\>echo %ORACLE_HOME%
%ORACLE_HOME%
C:\>where sqlplus
'where' is not recognized as an internal or external command,
operable program or batch file.
C:\>C:\App\oracle\product\19.db_home/deinstall/deinstall
The system cannot find the path specified.
C:\>
^ 但我有 sql plus ^ 我从来没有一个名为 oracle_home 的环境变量。这将返回当前 oracle 安装的 env 变量(不完整)
C:\>echo %path%
C:\App\oracle\product\19.3\db_home\bin;C:\Program Files (x86)\Applied Biosystems\QuantStudio Design
'Analysis' is not recognized as an internal or external command,
operable program or batch file.
我认为我正在尝试安装的新安装是安装程序唯一要安装的东西。但我不知道如何处理这条消息。我在哪里运行这个?
更新:我可以连接到我创建的 CDB,但没有 PDB$SEED。
但我有一个种子目录C:\App\oracle\oradata\ORCL\pdbseed
在计算机 2 上重新安装时出现问题:
INS-30014: Unable to check whether the location specified is on CFS
以下是 Oracle 对此错误的评价:
原因:指定的位置可能没有所需的权限。
行动:提供具有适当所需权限的位置。
所有用户(我、管理员、所有可能的用户)都拥有 D 盘的完全权限。
我发现的另一个解决方案INS-30014
是禁用网络适配器。我试过了,它仍然没有用。(我的以太网已经被禁用,所以我禁用了互联网,这并没有改变任何东西)。
我有一些要导出的表。我正在使用这个包(我称之为“CSV”):https ://www.williamrobertson.net/documents/refcursor-to-csv.shtml
在添加 CASE 语句之前,我能够写入 CSV 文件。我真的希望有办法解决它,因为我的 CASE 语句非常有用。
错误是:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "SYS.DBMS_SQL", line 2084
ORA-06512: at "C##USER1.CSV", line 38
ORA-06512: at "C##USER1.CSV", line 162
ORA-06512: at line 1
ORA-06512: at "C##USER1.CSV", line 278
ORA-06512: at "C##USER1.CSV", line 278
ORA-06512: at "C##USER1.EXPORT_02_PRODUCED_PURIFIED", line 5
ORA-06512: at "C##USER1.EXPORT_ALL_LYS_FOR_TABLEAU", line 5
这是错误指向的地方:
ORA-06512: at "C##USER1.EXPORT_02_PRODUCED_PURIFIED", line 5
在这儿:
CREATE OR REPLACE VIEW vw_export_02_produced_purified AS SELECT
pk_purified_enz_id,
fk_construct_id as "fk_for_construct",
fk_expr_system as "expression_system",
CASE pr.valid
WHEN 1 THEN 'Yes'
WHEN 0 THEN 'No'
END as "Is this growth ok?",
g_batch,
p_batch,
pur.concentration as "Concentration (uM)",
pur.abts5_pur_checkpoint as "purification checkpoint",
pur.yield as "Yield (mg/L)",
CASE
WHEN pk_purified_enz_id IS NULL THEN ' '
WHEN pk_purified_enz_id IS NOT NULL THEN
buffer_mol || ' mM, ' ||
fk_final_buffer_system || ' ' ||
'pH ' || final_ph || ', ' ||
final_nacl || ' mM NaCl' ||
CASE
WHEN final_add IS NULL THEN ' '
WHEN final_add IS NOT NULL THEN ', ' || final_add
END
END AS "Purification Buffer",
buffer_mol,
fk_final_buffer_system as "buffer system",
final_ph,
final_nacl,
final_add as "other buffer additives"
FROM produced pr FULL OUTER JOIN purified_enz pur
on pr.pk_produced_id = pur.fk_produced_id;
CREATE OR REPLACE PROCEDURE EXPORT_02_PRODUCED_PURIFIED AS
l_dataset sys_refcursor;
begin
open l_dataset for select * from vw_export_02_produced_purified;
csv.write_file
( p_dataset => l_dataset
, p_heading => 'Y'
, p_directory => 'EXTRACT_DIR'
, p_filename => '02_produced_purified.txt' );
END EXPORT_02_PRODUCED_PURIFIED;
/
这个ORA-06512: at "C##USER1.EXPORT_ALL_LYS_FOR_TABLEAU", line 5
来自主程序,它结合了所有较小的程序。
CREATE OR REPLACE PROCEDURE EXPORT_ALL_LYS_FOR_TABLEAU AS
BEGIN
EXPORT_00_CPP;
EXPORT_01_CONSTRUCT;
EXPORT_02_PRODUCED_PURIFIED;
EXPORT_03_CHAR;
EXPORT_04_CELL_DATA;
END EXPORT_ALL_LYS_FOR_TABLEAU;
/
被引用的表的 DDL:
CREATE TABLE PRODUCED (
pk_produced_id NUMBER GENERATED ALWAYS AS IDENTITY,
fk_construct_id NUMBER NOT NULL,
g_batch VARCHAR2 (50) NOT NULL,
full_g_batch VARCHAR2 (200) GENERATED ALWAYS AS (g_batch || '-' || fk_construct_id) VIRTUAL,
valid NUMBER (1) DEFAULT 1,
fk_expr_system VARCHAR2 (50),
CONSTRAINT pk_produced_id PRIMARY KEY (pk_produced_id),
CONSTRAINT fk_p_construct_id FOREIGN KEY (fk_construct_id) REFERENCES construct (pk_construct_id),
CONSTRAINT fk_expr_system FOREIGN KEY (fk_expr_system) REFERENCES EXPR_SYSTEM(pk_expr_system),
CONSTRAINT uq_produced UNIQUE (fk_construct_id, g_batch)
);
CREATE TABLE PURIFIED_ENZ (
pk_purified_enz_id NUMBER GENERATED ALWAYS AS IDENTITY,
fk_produced_id NUMBER,
p_batch VARCHAR2 (50) NOT NULL,
pur_profile BLOB,
fk_final_buffer_system VARCHAR2 (50),
buffer_mol NUMBER (6, 2),
final_nacl NUMBER (4),
final_ph NUMBER (4, 2),
final_add VARCHAR2 (50),
yield NUMBER (6, 2),
concentration NUMBER (6, 2),
abts5_pur_checkpoint NUMBER (5, 2),
CONSTRAINT pk_purified_enz_id PRIMARY KEY (pk_purified_enz_id),
CONSTRAINT fk_produced_id FOREIGN KEY (fk_produced_id) REFERENCES produced (pk_produced_id),
CONSTRAINT fk_final_buffer_system FOREIGN KEY (fk_final_buffer_system) REFERENCES buffer_system (pk_final_buffer_system),
CONSTRAINT uq_purified_enz UNIQUE (fk_produced_id, p_batch)
);
我有一些我加入的表,我认为它们非常适合放入集群。但我也希望每周向其中插入数据。不是大量的数据——比如每周 5 到 20 条记录。我的理解是,集群对于您加入和从中选择的表很有用,但如果您打算在它们上使用 DML 语句,那么就不那么好了。
我的问题是:当 Oracle 文档说集群对于 DML 语句的使用效率不高时,他们指的是更新和删除数百条记录吗?或者插入的少量记录也属于该准则?我的问题本质上是,DML 语句的规模是否会影响集群的效率?或者它更像是一种二元情况。比如,如果我每天更新一条记录,我应该避免将我的表放在一个集群中吗?
我无法安排要运行的作业。
我制作了一个编写 CSV 文件的程序,当我执行它时它就可以工作。
然后我试着做一个工作来安排它:
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'AUTOMATE_CSV_EXPORT',
job_type => 'STORED_PROCEDURE',
job_action => 'EXPORT_ALL_LYS_FOR_TABLEAU',
number_of_arguments => 0,
start_date => '20-AUG-20 2.05.00PM',
repeat_interval => 'FREQ=WEEKLY; BYDAY=FRI; BYHOUR=23;',
end_date => NULL,
enabled => FALSE,
auto_drop => FALSE,
comments => 'hello i am a comment');
DBMS_SCHEDULER.SET_ATTRIBUTE(
name => 'AUTOMATE_CSV_EXPORT',
attribute => 'logging_level',
value => DBMS_SCHEDULER.LOGGING_RUNS);
DBMS_SCHEDULER.enable(
name => 'AUTOMATE_CSV_EXPORT');
END;
/
它没有在预定的时间运行,但是当我像这样运行它时它确实运行了:
我试图在向导中编辑开始时间,它给了我这个错误:
我从不久前开始安排它每 2 分钟运行一次,但它还没有运行。它肯定是启用的。
故障排除
TLDR:调度程序工作!唯一不起作用的是我输入电子邮件以获取通知。
我将工作更改为每 2 分钟运行一次。 ^^^所以它工作?但我在目标文件夹中看不到任何 CSV。我像下面的代码一样将开始日期更改为 NULL 并且它起作用了!我有 CSV!
- 测试计划的工作:测试:
create or replace procedure test_print
is
begin
dbms_output.put_line('Current date and time is : ' ||
to_char(sysdate,'DD-MON-YYYY HH:MI:SS AM'));
end;
set serveroutput on;
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'JOB_TEST',
job_type => 'STORED_PROCEDURE',
job_action => 'TEST_PRINT',
number_of_arguments => 0,
start_date => NULL,
repeat_interval => 'FREQ=MINUTELY;INTERVAL=2;',
end_date => NULL,
enabled => FALSE,
auto_drop => FALSE,
comments => 'Testing job runs');
DBMS_SCHEDULER.enable(name => 'JOB_TEST');
END;
/
select job_name,output,status,owner
from user_scheduler_job_run_details where job_name='JOB_TEST';
仍然不起作用的是通过电子邮件通知。当这是我唯一编辑的内容时,我收到此错误:
这是我的原始程序,效果很好:
create or replace PROCEDURE EXTRACT_0_CPP AS
CURSOR c_data IS
SELECT cpp,
rfu1,
rfu2,
mean_rfu,
charge_ph7_4,
hydropathy
FROM cpp
ORDER BY LENGTH(cpp);
F1 UTL_FILE.FILE_TYPE;
BEGIN
F1 := UTL_FILE.FOPEN( location => 'EXTRACT_DIR',
filename => '0_cpp.TXT',
open_mode => 'w',
max_linesize => 32767);
FOR cur_rec IN c_data LOOP
UTL_FILE.PUT_LINE (F1,
cur_rec.cpp || ':' ||
cur_rec.rfu1 || ':' ||
cur_rec.rfu2 || ':' ||
cur_rec.mean_rfu || ':' ||
cur_rec.charge_ph7_4 || ':' ||
cur_rec.hydropathy);
END LOOP;
UTL_FILE.FCLOSE(F1);
END;
但是 SQL Developer 在下面给了我一条弯曲的红线,SELECT
并建议我将其更改为:
create or replace PROCEDURE EXTRACT_0_CPP AS
CURSOR c_data IS
SELECT
"A1"."CPP" "CPP",
"A1"."RFU1" "RFU1",
"A1"."RFU2" "RFU2",
"A1"."MEAN_RFU" "MEAN_RFU",
"A1"."CHARGE_PH7_4" "CHARGE_PH7_4",
"A1"."HYDROPATHY" "HYDROPATHY"
FROM
"C##ELLIE"."CPP" "A1"
ORDER BY
length("A1"."CPP");
F1 UTL_FILE.FILE_TYPE;
BEGIN
F1 := UTL_FILE.FOPEN( location => 'EXTRACT_DIR',
filename => '0_cpp.TXT',
open_mode => 'w',
max_linesize => 32767);
FOR cur_rec IN c_data LOOP
UTL_FILE.PUT_LINE (F1,
cur_rec.pk_cpp || ':' ||
cur_rec.rfu1 || ':' ||
cur_rec.rfu2 || ':' ||
cur_rec.mean_rfu || ':' ||
cur_rec.charge_ph7_4 || ':' ||
cur_rec.hydropathy);
END LOOP;
UTL_FILE.FCLOSE(F1);
END;
我的问题是(为什么)这更好?什么是“A1”?
我正在尝试从外部表中插入数据。
INSERT /*+ ignore_row_on_dupkey_index ( consruct ( construct_id ) ) */
INTO construct
(construct_id,
n_term ,
enz_name,
c_term,
cpp,
mutations,
mw_kda)
SELECT *
FROM EXTERNAL ((
construct_id NUMBER(10),
n_term VARCHAR2 (50),
enz_name VARCHAR2 (50),
c_term VARCHAR2 (50),
cpp VARCHAR2 (50),
mutations VARCHAR2 (50),
mw_kda NUMBER (7,3))
TYPE ORACLE_LOADER
DEFAULT DIRECTORY data_to_input
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
SKIP 1
BADFILE bad_files:'badflie_insert_into_construct_from_construct.bad'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
MISSING FIELD VALUES ARE NULL
)
LOCATION ('CONSTRUCT.CSV')
REJECT LIMIT UNLIMITED) ext
WHERE NOT EXISTS (
SELECT * FROM construct c
WHERE c.n_term = ext.n_term
AND c.enz_name = ext.enz_name
AND c.c_term = ext.c_term
AND c.cpp = ext.cpp
AND c.mutations = ext.mutations
);
但现在我得到这个错误:
Error at Command Line : 171 Column : 7
Error report -
SQL Error: ORA-00957: duplicate column name
00957. 00000 - "duplicate column name"
第 171 行是这部分的最后一行
INSERT /*+ ignore_row_on_dupkey_index ( consruct ( construct_id ) ) */
INTO construct
(construct_id,
n_term ,
enz_name,
c_term,
cpp,
mutations,
mw_kda)
这显然不是重复的列。
如果我做:
INSERT /*+ ignore_row_on_dupkey_index ( consruct ( construct_id ) ) */
INTO construct
(construct_id,
n_term,
enz_name,
c_term,
cpp,
mutations,
mw_kda)
SELECT *
FROM EXTERNAL ((
ext.construct_id NUMBER (10),
ext.n_term VARCHAR2 (50),
ext.enz_name VARCHAR2 (50),
ext.c_term VARCHAR2 (50),
ext.cpp VARCHAR2 (50),
ext.mutations VARCHAR2 (50),
ext.mw_kda NUMBER (7,3))
TYPE ORACLE_LOADER
DEFAULT DIRECTORY data_to_input
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
SKIP 1
BADFILE bad_files:'badflie_insert_into_construct_from_construct.bad'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
MISSING FIELD VALUES ARE NULL
)
LOCATION ('CONSTRUCT.CSV')
REJECT LIMIT UNLIMITED) ext
WHERE NOT EXISTS (
SELECT * FROM construct c
WHERE c.n_term = ext.n_term
AND c.enz_name = ext.enz_name
AND c.c_term = ext.c_term
AND c.cpp = ext.cpp
AND c.mutations = ext.mutations
);
我明白了
Error at Command Line : 174 Column : 10
Error report -
SQL Error: ORA-00902: invalid datatype
00902. 00000 - "invalid datatype"
第 171 行是ext.construct_id NUMBER (10),
我已成功创建错误记录表
BEGIN
DBMS_ERRLOG.create_error_log(
dml_table_name => 'enzyme',
skip_unsupported => TRUE);
END;
/
desc ERR$_ENZYME;
Name Null? Type
--------------- ----- --------------
ORA_ERR_NUMBER$ NUMBER
ORA_ERR_MESG$ VARCHAR2(2000)
ORA_ERR_ROWID$ UROWID
ORA_ERR_OPTYP$ VARCHAR2(2)
ORA_ERR_TAG$ VARCHAR2(2000)
ENZ_NAME VARCHAR2(4000)
但是当我尝试运行此查询时出现错误:
insert /*+ ignore_row_on_dupkey_index ( enzyme ( enz_name ) ) */
into enzyme
SELECT enz_name FROM EXTERNAL ((
construct_id NUMBER(10),
n_term VARCHAR2 (50),
enz_name VARCHAR2 (3),
c_term VARCHAR2 (50),
cpp VARCHAR2 (50),
mutations VARCHAR2 (50),
mw_kda NUMBER (7, 3))
TYPE ORACLE_LOADER
DEFAULT DIRECTORY data_to_input
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
skip 1
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
MISSING FIELD VALUES ARE NULL
)
LOCATION ('CONSTRUCT.CSV')
LOG ERRORS INTO ERR$_ENZYME ('INSERT') REJECT LIMIT UNLIMITED) ext
where not exists (
select * from enzyme e
where e.enz_name = ext.enz_name
);
Error at Command Line : 79 Column : 5
Error report -
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"
*Cause:
*Action:
第 79 行是 LOG ERRORS INTO 行。
如果我删除该LOG ERRORS INTO ERR$_ENZYME ('INSERT')
部分,此命令将完美运行。