AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / dba / 问题

问题[oracle-sql-developer](dba)

Martin Hope
AnTiCoD
Asked: 2022-06-29 10:36:29 +0800 CST

在哪个表中查找我可以找到多个列

  • -1

我正在尝试编写一个查询,它将向我显示包含以下列的表:ProductGroup、ProductClass和ProductID。

但我在这方面不是很成功。有人可以帮我吗?

oracle oracle-sql-developer
  • 2 个回答
  • 28 Views
Martin Hope
User1974
Asked: 2022-02-08 14:41:26 +0800 CST

如何请求对 Oracle SQL Developer 进行增强

  • 0

关于 Oracle 的SQL Developer工具:

有没有办法要求 Oracle 对该工具进行增强?

例如,我想要求Oracle添加这个功能:Generate WITH clause from resultset using SQL Developer

oracle oracle-sql-developer
  • 2 个回答
  • 59 Views
Martin Hope
Jeromy French
Asked: 2022-01-11 06:44:16 +0800 CST

如何让 SQL Developer 编译包含 DDL 中的代码的代码?

  • 0

我正在准备 SQL 脚本,它可以将一组代码部署到目标环境中,而无需大惊小怪。我希望执行 DBA 只需登录到目标数据库并执行“install_release.sql”。该文件“包含”(通过SQL Developer 支持的“@”命令)其他脚本:

PROMPT Compile package specs...
    PROMPT ...package A
    @../../../path/to/packageA/spec.sql

    PROMPT ...package B
    @../../../path/to/packageB/spec.sql

PROMPT Compile package bodies...
    PROMPT ...package A
    @../../../path/to/packageA/body.sql

    PROMPT ...package B
    @../../../path/to/packageB/body.sql

该过程的这一部分似乎效果很好。

但是,每个包主体都试图包含要包含在包定义中的常见、重复的 SQL 片段(例如,标准EXCEPTION声明)。例如,“exception_declarations.sql”包含如下代码:

EMPTY_PARAMTER         EXCEPTION
INSUFFICIENT_ACCESS    EXCEPTION

而“packageA/body.sql”包含如下代码:

CREATE OR REPLACE PACKAGE BODY My_Schema.PackageA AS
    @../../../path/to/exception_declarations.sql

FUNCTION ETC(...etc...

当我尝试从 SQL Developer 作为脚本执行“install_release.sql”时,我可以从生成的日志中看到编译器遵循编译规范的路径(没问题),并进入包体......但一旦进入包体,它在尝试执行时抛出此错误@../../../path/to/exception_declarations.sql:

在预期以下内容时遇到符号“@”:begin end function pragma procedure subtype type current cursor delete exists prior

更神秘的是,当通过 SQL Plus 执行时,这个完全相同的代码可以按预期编译(没有错误)(我只是使用 SQL Plus,但我正在通过一个相当锁定的虚拟机远程工作,它不会让我安装 SQL另外......但确实让我“安装”SQL Developer......它很复杂......我不喜欢谈论它,因为那时恶魔开始嘲笑我)。

我在这里做错了什么?为什么编译器会遵循一组脚本中的路径,而不是包体代码中的路径?我认为这是因为@命令嵌入在 DDL 中......所以......我怎样才能让 SQL Developer 编译包含 DDL 中的代码的代码?

oracle-sql-developer
  • 1 个回答
  • 131 Views
Martin Hope
Taras
Asked: 2021-03-09 22:40:59 +0800 CST

仅将所需值与 LISTAGG 连接

  • 3

在 Oracle DB 中有一个包含数据的表"YEARS",请参见下面的表/图像

+-----+-----------+------------------+
| FID |    I0     |       BJA        |
+-----+-----------+------------------+
|   1 |     0     |       1949       |
|   2 |     0     |       1996       |
|   3 |     0     |       1970       |
|   4 |     1     |       1871       |  
|   4 |     0     |       1975       |
|   5 |     0     |       1967       |
|   6 |     0     |       1968       |
|   7 |     0     |       1926       |
|   7 |     1     |       2009       |
|   7 |     2     |       2012       |
|   7 |     3     |       2018       |
|   8 |     0     |       1956       |
|   9 |     0     |       1990       |
|  10 |     0     |       1953       |
|  10 |     1     |       1904       |
| ... |    ...    |       ...        |
+-----+-----------+------------------+

片断表

我试图创建一个小提琴(在这里),但它没有用......

CREATE TABLE YEARS (
    "FID" NUMBER(10,0) NOT NULL, 
    "I0" NUMBER(10,0) NOT NULL, 
    "BJA" NUMBER(10,0)
);

INSERT ALL
    INTO YEARS ("FID","I0","BJA") VALUES (1,0,1949)
    INTO YEARS ("FID","I0","BJA") VALUES (2,0,1996)
    INTO YEARS ("FID","I0","BJA") VALUES (3,0,1970)
    INTO YEARS ("FID","I0","BJA") VALUES (4,1,1871)
    INTO YEARS ("FID","I0","BJA") VALUES (4,0,1975)
    INTO YEARS ("FID","I0","BJA") VALUES (5,0,1967)
    INTO YEARS ("FID","I0","BJA") VALUES (6,0,1968)
    INTO YEARS ("FID","I0","BJA") VALUES (7,0,1926)
    INTO YEARS ("FID","I0","BJA") VALUES (7,1,2009)
    INTO YEARS ("FID","I0","BJA") VALUES (7,2,2012)
    INTO YEARS ("FID","I0","BJA") VALUES (7,3,2018)
    INTO YEARS ("FID","I0","BJA") VALUES (8,0,1956)
    INTO YEARS ("FID","I0","BJA") VALUES (9,0,1990)
    INTO YEARS ("FID","I0","BJA") VALUES (10,0,1953)
    INTO YEARS ("FID","I0","BJA") VALUES (10,1,1904)
    
SELECT 1 FROM dual;

我正在尝试执行以下查询:

SELECT YEARS.FID,
       MIN(YEARS.BJA) AS "CONSTRYEAR",
       LISTAGG(YEARS.BJA, ', ') WITHIN GROUP (ORDER BY YEARS.BJA ASC) AS "RECONSTRYEAR"
FROM DB.YEARS YEARS
GROUP BY YEARS.FID;

以及上述查询的输出:

片段结果

但是,这不是我想要的结果……是的,我正在阅读文档source 1、source 2和source 3;并且我也看到了相关的线程如何一起使用 LISTAGG 和 WHERE以及如何使用带有唯一过滤器的 Oracle 的 LISTAGG 函数?.

我怎样才能得到这样的结果:

+-----+-----------+------------------+
| FID | CONSTRUCT |   RECONSTRYEAR   |
+-----+-----------+------------------+
|   1 |      1949 |                  |
|   2 |      1996 |                  |
|   3 |      1970 |                  |
|   4 |      1871 |             1975 |
|   5 |      1967 |                  |
|   6 |      1968 |                  |
|   7 |      1926 | 2009, 2012, 2018 |
|   8 |      1956 |                  |
|   9 |      1990 |                  |
|  10 |      1904 |             1953 |
+-----+-----------+------------------+

您看到"CONSTRUCT"列中的值被排除在"RECONSTRYEAR". 我不明白我需要在哪里放置一个WHERE YEARS.IO != 0子句LISTAGG,所以不会包括最低年份。

query oracle-sql-developer
  • 4 个回答
  • 137 Views
Martin Hope
Casivio
Asked: 2021-03-09 15:43:26 +0800 CST

我如何第一次登录 SQL Developer?

  • -1

我刚刚安装了 Oracle 19c 和 SQL Developer。我打开 SQL Developer 并尝试建立一个新连接,但我得到了

“侦听器拒绝连接并出现以下错误:ORA-12505,TNS:侦听器当前不知道连接描述符中给出的 SID (CONNECTION_ID=HYjeJ...==)”。

我正在尝试与

Username: SYS
Role: SYSDBA
Hostname: localhost
SID: xe (this is the default, I know nothing about it)

我尝试使用“ALTER USER SYS IDENTIFIED BY oracle ACCOUNT UNLOCK;”更改 SYS 用户密码 正如这里推荐的那样。我只能使用 SYS 作为 SYSDBA 登录 SQL Plus,并且没有密码。我试图创建一个用户并设置他们的个人资料以允许登录,但这样做会出错。

编辑:

lsnrctl status

LSNRCTL for 64-bit Windows: Version 19.0.0.0.0 - Production on 08-MAR-2021 19:39:44

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 64-bit Windows: Version 19.0.0.0.0 - Production
Start Date                04-MAR-2021 07:42:09
Uptime                    4 days 11 hr. 57 min. 52 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   C:\Desktop\Drawer\Tutorials\Oracle\WINDOWS.X64_193000_db_home\network\admin\listener.ora
Listener Log File         C:\Desktop\Drawer\Tutorials\Oracle\diag\tnslsnr\AlbuGierke\listener\alert\log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=AlbuGierke)(PORT=5500))(Security=(my_wallet_directory=C:\DESKTOP\DRAWER\TUTORIALS\ORACLE\admin\orcl\xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "0154b89e82cd4245957cd2ed1b57502d" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "52448234712340b69f274bcc790ecfe0" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclpdb" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

编辑二:

将@EdStevens 解决方案更进一步,我通过SELECT * FROM all_users ORDER BY CREATED;在 SQL Plus 中运行命令来识别可用用户。然后,我使用安装时创建的 PDBADMIN 用户(在 19c 发布时似乎已经创建了几个用户)来完成连接。

oracle oracle-sql-developer
  • 1 个回答
  • 318 Views
Martin Hope
OSGI Java
Asked: 2020-08-04 10:34:45 +0800 CST

连接远程Oracle数据库时如何解决供应商代码17002?

  • 0

我有一个在 AWS ec2 的 Linux 实例上运行的 Oracle 数据库 12c 标准版版本 12.2.0.1.0。当我尝试使用 SQL Developer 从我的机器 (macOS) 远程连接到它时,我收到一个IO Error: The Network Adapter could not establish the connection Vendor Code 17002错误。

  • 在我的机器上使用 sqlplus 进行连接:
sqlplus cd2/ @ec2-publicIp.myCloud.compute.amazonaws.com:1522/orcl

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Aug 3 15:30:56 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

ERROR:
ORA-12541: TNS:no listener
  • 在 ec2 实例 Security Groups 上,为我的机器的公共 IP 打开了一个 TCP 1522 端口
  • telnet 到实例,端口 1522 似乎表明该端口是开放的:
telnet ec2-pubIp.compute.amazonaws.com 1522
Trying pubIp...
telnet: connect to address pubIp: Connection refused
telnet: Unable to connect to remote host
  • 端口 1522 在所有配置中一致使用
  • 我验证了 ec2 主机名(hostname命令)与从lsnrctl status. 输出显示localhost而不是ip-localIp.myCloud.compute.internal。
$ hostname
ip-localIp.myCloud.compute.internal
$ lsnrctl status
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 03-AUG-2020 15:20:44

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ip-localIp.myCloud.compute.internal)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                03-AUG-2020 13:30:22
Uptime                    0 days 1 hr. 50 min. 22 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/centos/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/centos/diag/tnslsnr/ip-localIp/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))
Services Summary...
Service "orcl.myCloud.compute.internal" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB.myCloud.compute.internal" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

  • 主机名和端口也与配置的默认侦听器匹配listener.ora:
cat /u01/app/centos/product/12.2.0/dbhome_1/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/centos/product/12.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ip-localIp.myCloud.compute.internal)(PORT = 1522))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
    )
  )
  • Oracle 参数如图所示,主机和端口再次匹配:
SQL> show parameter listener_networks

NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
listener_networks            string

SQL> show parameter local_listener

NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
local_listener               string  (ADDRESS=(PROTOCOL=TCP)(HOST =
                          ip-localIp.myCloud
                         .compute.internal)(PORT = 1522
                         ))

SQL> show parameter remote_listener

NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
remote_listener              string
  • 我可以从 ec2 实例连接:sqlplus / as sysdba
  • 我可以从 ec2 实例作为模式/用户 cd2 连接:
sqlplus cd2/ @orcl

SQL*Plus: Release 12.2.0.1.0 Production on Mon Aug 3 18:04:13 2020

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Enter password: 
Last Successful login time: Mon Aug 03 2020 18:03:52 +00:00

Connected to:
Oracle Database 12c Standard Edition Release 12.2.0.1.0 - 64bit Production

SP2-0310: unable to open file "orcl.sql"
SQL> select 1 from dual;

     1
----------
     1

SQL> 

  • SQL Developer 连接匹配端口和 ec2 的公共域名: 在此处输入图像描述
  • 这个数据库服务器是我们的开发实例,所以没有安装许可证
  • listener.ora通过将HOST值设置为更新0.0.0.0,重新启动lsnrctl但结果相同:
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1522))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
    )
  )

  • /etc/hosts内容:
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 ip-localIp.myCloud.compute.internal
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
  • 我还使用所有入站流量和为 ec2 实例打开的所有端口对其进行了测试
oracle-sql-developer oracle-12c
  • 2 个回答
  • 32334 Views
Martin Hope
r0tt
Asked: 2019-05-04 00:15:39 +0800 CST

SQL Developer 导出/导入 SSH 主机

  • 0

是否可以从 SQL Developer 导出/导入 ssh 主机?主机列在 C:\Users\name\AppData\Roaming\SQL Developer\system17.4.0.355.2349\o.sqldeveloper.ssh 下,但我找不到将它们导出/导入到 SQL Developer 的方法。

oracle-sql-developer
  • 1 个回答
  • 1133 Views
Martin Hope
Deepak Kumar
Asked: 2019-04-17 03:55:41 +0800 CST

如何在导入/导出时强制 SQL 开发人员使用 imp/exp 命令

  • 0

默认情况下,使用 SQL Developer 导入或导出 oracle 数据转储时,它使用impdp命令进行导入和expdp命令进行导出。但是我想导入一个使用exp命令导出的转储,为此我需要强制 SQL 开发人员使用imp命令而不是impdp命令。出口也一样。

如果有人知道如何强制 SQL 开发人员使用imp导入而不是impdp导出exp,请帮助我expdp

oracle oracle-sql-developer
  • 1 个回答
  • 1359 Views
Martin Hope
ps0604
Asked: 2019-03-10 13:39:24 +0800 CST

ORA-01017 SQL Developer 中的用户名/密码无效

  • 1

我安装了 Oracle 18c XE 和 SQL Developer 18.4,都是最新的。

vbk使用 SYSTEM 登录并在 SQL Developer 中创建用户。

我看到用户正在运行select * from dba_users,但是当我尝试在 SQL Developer 中连接时,它说

ORA-01017 Invalid Username/Password

我尝试使用 SYSTEM 用户重置密码:

ALTER USER vbk IDENTIFIED BY xxx;

我得到

ORA-01918: user 'VBK' does not exist 

我在消息中看到用户名是大写的,即使用户是用小写创建的。

如何与用户建立联系?

oracle oracle-sql-developer
  • 1 个回答
  • 6267 Views
Martin Hope
vesperto
Asked: 2018-12-20 02:20:18 +0800 CST

sqlplus SP2-0341(变量替换期间行溢出)

  • 0

我想将 Oracle 数据库导出到一个文件中,为此我在 Windows 上使用 SQLDeveloper(生成的 SQL 文本文件大约为 35MB)。这导致很长的行。

在 linux 上使用 sqlplus 导入文件时遇到了问题:

SP2-0341: line overflow during variable substitution (>3000 characters at line 1)

这发生在多行上。

我看不到有关如何在导出时限制行长的选项。我试图设置线条大小然后导出,但无济于事。我也尝试过编辑该文件,但我使用的 vim 工具专注于显式行长而不是 SQL 的语义(它们会破坏字符串)。此外,我的 regex-fu 只能VALUES用换行符包围关键字,但即便如此,行数仍然比 3000 长得多。此外,35MB 需要手动编辑。

我仅限于这些工具和 RDBMS,但我愿意接受建议。

oracle oracle-sql-developer
  • 3 个回答
  • 15776 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve