我正在尝试搜索Oracle数据库中的特定内容,但是我不知道它是表,模式还是用户等...
如果类型未知,是否有任何命令可以搜索字符串?
例如: SQL>显示字符串“ the_string”
答案 0 :(得分:4)
尝试一下:
select * from all_objects where object_name like '%your object name%'
也请注意
您需要为用户分配适当的访问权限。
答案 1 :(得分:2)
这是一个应该有所帮助的统一查询:
SELECT 'User/Schema' match_type,
username
FROM dba_users -- if you have access to dba_users uses all_users instead
WHERE UPPER(username) LIKE '%THE_STRING%'
UNION
SELECT object_type,
owner || '.' || object_name object_name
FROM dba_objects -- or all_objects if no access to dba_objects
WHERE UPPER ( owner || '.' || object_name ) LIKE '%THE_STRING%'
ORDER BY 1, 2
/
请注意,dba_
视图将显示所有(匹配项),all_
视图将仅显示您有权访问的对象的匹配项。
答案 2 :(得分:0)
除了OldProgrammer的答案外,如果该查询未返回任何信息,则要查找名称是否是用户ID(基本上与模式同义),还需要查询# Load the CLIXML file into a [System.Xml.XmlDocument] ([xml]) instance.
($credXml = [xml]::new()).Load($PWD.ProviderPath + '\MyCredentials.xml')
# Take an XPath shortcut that avoids having to deal with namespaces.
# This should be safe, if you know your XML file to have been created with
# Get-Credential | Export-CliXml MyCredentials.xml
$username, $encryptedPassword =
$credXml.SelectNodes('//*[@N="UserName" or @N="Password"]').'#text'
$networkCred = [pscredential]::new(
$username,
(ConvertTo-SecureString $encryptedPassword)
).GetNetworkCredential()
$networkCred.UserName
# $networkCred.Password # CAUTION: This would echo the plain-text password.
或ALL_USERS
:
DBA_USERS