此产品的文档集力求使用非歧视性语言。在本文档集中,非歧视性语言是指不隐含针对年龄、残障、性别、种族身份、族群身份、性取向、社会经济地位和交叉性的歧视的语言。由于产品软件的用户界面中使用的硬编码语言、基于 RFP 文档使用的语言或引用的第三方产品使用的语言,文档中可能无法确保完全使用非歧视性语言。 深入了解思科如何使用包容性语言。
思科采用人工翻译与机器翻译相结合的方式将此文档翻译成不同语言,希望全球的用户都能通过各自的语言得到支持性的内容。 请注意:即使是最好的机器翻译,其准确度也不及专业翻译人员的水平。 Cisco Systems, Inc. 对于翻译的准确性不承担任何责任,并建议您总是参考英文原始文档(已提供链接)。
本文档介绍如何通过CLI获取具有结构化查询语言(SQL)查询的用户邮箱的邮件计数和大小。也可以使用Cisco Unified Communications Tools页的User Data Dump工具检索。
思科建议您了解Cisco Unity Connection(CUC)。
本文档中的信息基于CUC版本8.X及更高版本,但此信息可能也适用于早期版本。
SQL查询由来自以下数据库的数据构成:
SQL查询是使用这些视图中的数据形成的。视图是两个或多个表的组合或单个表中相同数据的表。
这些视图用于UnityDirDB数据库:
UnityMbxDB1数据库中使用以下视图:
本节介绍可在CUC中使用的各种SQL查询。
输入以下命令以获取具有已知别名的总消息计数列表:
admin:run cuc dbquery unitymbxdb1 select count (*) as Messages from vw_message,
unitydirdb:vw_mailbox, unitydirdb:vw_user where mailboxobjectid in (select
mailboxid from vw_mailbox where unitydirdb:vw_user.objectid = unitydirdb:
vw_mailbox.userobjectid and alias='Anirudh')
messages
--------
3
此查询是包含多个表的高复杂性双数据库查询。对于数据库和邮箱大小非常大的服务器,输出显示前可能会经过一段较长的时间,即使超过一小时,这并不理想。在这些情况下,您可以改用此查询:
admin:run cuc dbquery unitymbxdb1 select count (*) as Messages from vw_message
where mailboxobjectid in (select mailboxobjectid from vw_mailbox where
description='Anirudh')
messages
--------
3
提到别名时,第一个查询返回数据,该别名为Unique。当提到描述时,第二个查询返回数据,该描述不唯一。
注意:创建邮箱时,说明与别名相同;但是,更新别名时,说明不会更新。对于小型数据库,第一个查询是理想的。为了演示更改别名后说明不会更改,将test3修改为Atest3并用于下一部分。
输入以下命令以获取具有总消息计数的用户列表:
admin:run cuc dbquery unitymbxdb1 select alias as UserID, count (*) as messages
from vw_message, unitydirdb:vw_mailbox, unitydirdb:vw_user where
mailboxobjectid in (select mailboxid from vw_mailbox where unitydirdb:
vw_user.objectid = unitydirdb:vw_mailbox.userobjectid) group by alias order by
messages desc
userid messages
---------------------------- --------
Anirudh 3
Atest3 2
undeliverablemessagesmailbox 1
出于与“使用已知别名列出总邮件数”部分中提及的相同原因,此查询也可以使用:
admin:run cuc dbquery unitymbxdb1 select description, count (*) as Messages from
vw_message, vw_mailbox where vw_mailbox.mailboxobjectid =
vw_message.mailboxobjectid group by description order by messages desc
description messages
---------------------------- --------
Anirudh 3
test3 2
undeliverablemessagesmailbox 1
注意:在第二个查询中,别名更改后,说明不会从test3更改为Atest3。
输入以下命令以根据别名的第一个字符获取消息总数的用户列表:
admin:run cuc dbquery unitymbxdb1 select alias as UserID, count (*) as messages from
vw_message, unitydirdb:vw_mailbox, unitydirdb:vw_user where deleted='0' and
mailboxobjectid in (select mailboxid from vw_mailbox where unitydirdb:
vw_user.objectid = unitydirdb:vw_mailbox.userobjectid) and alias like 'A%' group by
alias order by messages
userid messages
------- --------
Atest3 2
Anirudh 3
出于与“使用已知别名列出总邮件数”部分中提及的相同原因,此查询也可以使用:
admin:run cuc dbquery unitymbxdb1 select description, count (*) as Messages from
vw_message, vw_mailbox where vw_mailbox.mailboxobjectid =
vw_message.mailboxobjectid and description like 'A%' group by description order
by messages
以下是有关此查询的一些重要说明:
以下是一些示例条件:
到目前为止所提到的查询用于获取总邮件(收件箱和已删除项)。 下一节介绍用于获取收件箱和已删除邮件总数的查询。
输入以下命令以获取包含总收件箱消息的用户列表:
admin:run cuc dbquery unitymbxdb1 select alias as UserID, count (*) as
inboxmessages from vw_message, unitydirdb:vw_mailbox, unitydirdb:vw_user
where deleted='0' and mailboxobjectid in (select mailboxid from vw_mailbox
where unitydirdb:vw_user.objectid = unitydirdb:vw_mailbox.userobjectid) and
alias like 'A%' group by alias order by inboxmessages
userid inboxmessages
------- -------------
Atest3 2
Anirudh 3
出于与“使用已知别名列出总邮件数”部分中提及的相同原因,此查询也可以使用:
admin:run cuc dbquery unitymbxdb1 select description, count (*) as InboxMessages
from vw_message, vw_mailbox where vw_mailbox.mailboxobjectid =
vw_message.mailboxobjectid and deleted = '0' and description like 'A%' group by
description order by InboxMessages
以下是有关此查询的一些重要说明:
以下是一些示例条件:
注意:在本例中,使用条件以字母A开头的别名/描述限制用户。
以下是此查询的一些变体:
输入此命令以获取包含已删除邮件总数的用户列表:
admin:run cuc dbquery unitymbxdb1 select alias as UserID, count (*) as
deletedmessages from vw_message, unitydirdb:vw_mailbox, unitydirdb:vw_user
where deleted='1' and mailboxobjectid in (select mailboxid from vw_mailbox
where unitydirdb:vw_user.objectid = unitydirdb:vw_mailbox.userobjectid) and
alias like 'A%' group by alias order by deletedmessages
No records found
出于与“使用已知别名列出总邮件数”部分中提及的相同原因,此查询也可以使用:
admin:run cuc dbquery unitymbxdb1 select description, count (*) as
deletedmessages from vw_message, vw_mailbox where vw_mailbox.mailboxobjectid=
vw_message.mailboxobjectid and deleted = '1' and description like 'A%' group
by description order by deletedmessages
注意:在本示例中,没有删除的消息,因此输出显示为“找不到记录”。
以下是有关此查询的一些重要说明:
以下是一些示例条件:
注意:在本例中,使用条件以字母A开头的别名/描述限制用户。
以下是此查询的一些变体:
输入以下命令以获取包含总留言、收件箱留言和已删除留言的用户列表:
admin:run cuc dbquery unitymbxdb1 select alias as UserID, count (*) as messages,
sum(case when deleted='0' then 1 else 0 end) as Inboxmessages, sum(case when
deleted='1' then 1 else 0 end) as Deletedmessages from vw_message, unitydirdb:
vw_mailbox, unitydirdb:vw_user where mailboxobjectid in (select mailboxid from
vw_mailbox where unitydirdb:vw_user.objectid = unitydirdb:vw_mailbox.userobjectid)
group by alias order by messages desc
userid messages inboxmessages deletedmessages
---------------------------- -------- ------------- ---------------
Anirudh 3 3 0
Atest3 2 2 0
undeliverablemessagesmailbox 1 1 0
出于与“使用已知别名列出总邮件数”部分中提及的相同原因,此查询也可以使用:
admin:run cuc dbquery unitymbxdb1 select description as UserID, count (*) as
messages, sum(case when deleted='0' then 1 else 0 end) as Inboxmessages, sum
(case when deleted='1' then 1 else 0 end) as Deletedmessages from vw_mailbox
join vw_message on vw_message.mailboxobjectid=vw_mailbox.mailboxobjectid
group by description order by messages desc
以下是有关此查询的一些重要说明:
以下是一些示例条件:
注意:在本例中,使用条件以字母A开头的别名/描述限制用户。
以下是此查询的一些变体:
此查询可用于确定邮件箱清理的计划作业是否生效:
admin:run cuc dbquery unitymbxdb1 select alias as UserID, count (*) as messages,
min(arrivaltime) as OldestMessageTime from vw_message, unitydirdb:vw_mailbox,
unitydirdb:vw_user where mailboxobjectid in (select mailboxid from vw_mailbox
where unitydirdb:vw_user.objectid = unitydirdb:vw_mailbox.userobjectid) group
by alias order by messages desc
userid messages oldestmessagetime
---------------------------- -------- -----------------------
Anirudh 3 2013-03-19 14:38:14.459
Atest3 2 2013-01-18 05:49:45.355
undeliverablemessagesmailbox 1 2012-07-05 01:10:19.961
出于与“使用已知别名列出总邮件数”部分中提及的相同原因,此查询也可以使用:
admin:run cuc dbquery unitymbxdb1 select description, count (*) as Messages,
min(arrivaltime) as OldestMessageTime from vw_message, vw_mailbox where
vw_mailbox.mailboxobjectid = vw_message.mailboxobjectid group by description
order by messages desc
注意:要获取前几节中查询的“上次到达时间”,请将min(arrivaltime)添加为OldstMessageTime,稍后将count(*)添加为Messages。
以下是此查询的一些变体:
输入此命令以获取包含最早邮件到达时间和邮箱大小(无总持续时间)的用户邮件计数列表:
admin:run cuc dbquery unitymbxdb1 select alias as UserID, count (*) as messages,
min(arrivaltime) as OldestMessageTime, vw_mailbox.bytesize from vw_message,
vw_mailbox, unitydirdb:vw_mailbox, unitydirdb:vw_user where
vw_message.mailboxobjectid=vw_mailbox.mailboxobjectid and
vw_mailbox.mailboxobjectid in (select mailboxid from vw_mailbox where
unitydirdb:vw_user.objectid = unitydirdb:vw_mailbox.userobjectid) group by
alias, vw_mailbox.bytesize order by messages desc
userid messages oldestmessagetime bytesize
---------------------------- -------- ----------------------- --------
Anirudh 3 2013-03-19 14:38:14.459 93319
Atest3 2 2013-01-18 05:49:45.355 59890
undeliverablemessagesmailbox 1 2012-07-05 01:10:19.961 317003
注:要获取消息的总持续时间:在"from vw_message"前添加", sum(duration/1000)作为TotalDuration_In_sec"。请不要忘记和前的逗号。这也可用于前几节中的查询。
出于与“使用已知别名列出总邮件数”部分中提及的相同原因,此查询也可以使用:
admin:run cuc dbquery unitymbxdb1 select description, count (*) as Messages,
min(arrivaltime) as OldestMessageTime, vw_mailbox.bytesize from vw_message,
vw_mailbox where vw_mailbox.mailboxobjectid = vw_message.mailboxobjectid
group by description, vw_mailbox.bytesize order by messages desc
注意:要获取消息的总持续时间:在"from vw_message"前添加", sum(duration/1000)作为TotalDuration_In_sec"。请不要忘记和前的逗号。这也可用于前几节中的查询。
以下是此查询的一些变体:
输入此命令以获取用户收件箱和已删除邮件计数的列表,其中包含最旧邮件的到达时间和邮箱大小(不包含总持续时间):
admin:run cuc dbquery unitymbxdb1 select alias as UserID, count (*) as
TotalMessages, sum(case when deleted='0' then 1 else 0 end) as Inbox,
sum(case when deleted='1' then 1 else 0 end) as Deleted, min
(arrivaltime) as OldestMessageTime, vw_mailbox.bytesize from vw_message,
vw_mailbox, unitydirdb:vw_mailbox, unitydirdb:vw_user where
vw_message.mailboxobjectid=vw_mailbox.mailboxobjectid and
vw_mailbox.mailboxobjectid in (select mailboxid from vw_mailbox where
unitydirdb:vw_user.objectid = unitydirdb:vw_mailbox.userobjectid) group
by alias, vw_mailbox.bytesize order by TotalMessages desc
userid total inbox deleted oldestmessagetime byte
messages size
---------------- -------- ----- ------- ----------------------- ------
Anirudh 3 3 0 2013-03-19 14:38:14.459 93319
Atest3 2 2 0 2013-01-18 05:49:45.355 59890
undeliverable 1 1 0 2012-07-05 01:10:19.961 317003
messagesmailbox
注意:要获取消息的总持续时间:在"from vw_message"前添加", sum(duration/1000)作为TotalDuration_In_sec"。请不要忘记和前的逗号。这也可用于前几节中的查询。
出于与“使用已知别名列出总邮件数”部分中提及的相同原因,此查询也可以使用:
admin:run cuc dbquery unitymbxdb1 select description, count (*) as
TotalMessages, sum(case when deleted='0' then 1 else 0 end) as Inbox,
sum(case when deleted='1' then 1 else 0 end) as Deleted, min(arrivaltime)
as OldestMessageTime, vw_mailbox.bytesize from vw_message, vw_mailbox
where vw_mailbox.mailboxobjectid = vw_message.mailboxobjectid group by
description, vw_mailbox.bytesize order by TotalMessages desc
注意:要获取消息的总持续时间:在"from vw_message"前添加", sum(duration/1000)作为TotalDuration_In_sec"。请不要忘记和前的逗号。这也可用于前几节中的查询。
以下是此查询的一些变体:
输入此命令以获取所有邮箱的总邮件数:
admin:run cuc dbquery unitymbxdb1 select count(*) as messages
from vw_message
messages
----------
6
输入以下命令以获取具有发送和接收限制的用户邮箱大小:
admin:run cuc dbquery unitydirdb select alias as UserID,bytesize,send,receive,
warning from vw_user,unitymbxdb1:vw_mailbox where vw_user.objectid in (select
userobjectid from vw_usermailboxmap where
vw_usermailboxmap.mailboxid=unitymbxdb1:vw_mailbox.mailboxobjectid and
alias='Anirudh')
userid bytesize send receive warning
------- -------- -------- -------- --------
Anirudh 93319 13000000 14745600 12000000
出于与“使用已知别名列出总邮件数”部分中提及的相同原因,此查询也可以使用:
admin:run cuc dbquery unitymbxdb1 select description, bytesize,send,receive,
warning from vw_mailbox where description ='Anirudh'
输入以下命令以获取具有发送和接收限制的所有用户邮箱大小:
admin:run cuc dbquery unitydirdb select alias as UserID,bytesize,send,receive,
warning from vw_user,unitymbxdb1:vw_mailbox where vw_user.objectid in (select
userobjectid from vw_usermailboxmap where
vw_usermailboxmap.mailboxid=unitymbxdb1:vw_mailbox.mailboxobjectid) order by
bytesize desc
userid bytesize send receive warning
---------------------------- -------- -------- -------- --------
undeliverablemessagesmailbox 317003 13000000 14745600 12000000
Anirudh 93319 13000000 14745600 12000000
Atest3 59890 13000000 14745600 12000000
Solomon 0 13000000 14745600 12000000
UnityConnection 0 50000000 50000000 45000000
Suvir 0 13000000 14745600 12000000
dsas 0 13000000 14745600 12000000
test1 0 13000000 14745600 12000000
Atest2 0 13000000 14745600 12000000
operator 0 13000000 14745600 12000000
出于与“使用已知别名列出总邮件数”部分中提及的相同原因,此查询也可以使用:
admin:run cuc dbquery unitymbxdb1 select description, bytesize,send,receive,
warning from vw_mailbox order by bytesize desc
作为此查询的变体,以便列出别名以字母A开头的所有用户,按条件在第一个查询中添加别名,如“A%”,如vw_usermailboxmap.mailboxid=unitymbxdb1:vw_mailbox.mailboxobjectid和之前)后的vw_mailboxobjectid,或者可添加其中说明在第二个查询中,该查询正好位于按条件排序的前面。请确保将其添加到正确的位置,否则查询将失败。
输入此命令可获取所有邮箱的总大小:
admin:run cuc dbquery unitymbxdb1 select sum (bytesize) from vw_mailbox
(sum)
-------
2683210
admin: